mirror of
https://github.com/clearlinux/kvmtool.git
synced 2026-09-04 20:51:28 +00:00
kvm: load_bzimage: Proper check for number of setup sectors
We should check for the number of setup sectors before adding the last one. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
This commit is contained in:
committed by
Will Deacon
parent
6753ed2f8c
commit
4cf542bbd7
@@ -218,9 +218,9 @@ static bool load_bzimage(struct kvm *self, int fd)
|
||||
if (lseek(fd, 0, SEEK_SET) < 0)
|
||||
die_perror("lseek");
|
||||
|
||||
if (!boot.hdr.setup_sects)
|
||||
boot.hdr.setup_sects = BZ_DEFAULT_SETUP_SECTS;
|
||||
setup_sects = boot.hdr.setup_sects + 1;
|
||||
if (setup_sects == 0)
|
||||
setup_sects = BZ_DEFAULT_SETUP_SECTS;
|
||||
|
||||
setup_size = setup_sects << 9;
|
||||
p = guest_real_to_host(self, BOOT_LOADER_SELECTOR, BOOT_LOADER_IP);
|
||||
|
||||
Reference in New Issue
Block a user