When calculating the size of the buffer required for the VGA/VBE state,
round up rather than truncating when dividing the number of bytes to get
the number of 64-byte blocks. Without this modification, the save state
function will write past the end of a buffer of the size requested.
Signed-off-by: Daniel Verkamp <daniel@drv.nu>
if (ret < 0)
goto fail;
if (cmd == 0)
- regs->bx = ret / 64;
+ regs->bx = DIV_ROUND_UP(ret, 64);
regs->ax = 0x004f;
return;
fail:
if (ret < 0)
goto fail;
if (cmd == 0)
- regs->bx = ret / 64;
+ regs->bx = DIV_ROUND_UP(ret, 64);
regs->al = 0x1c;
fail:
return;