From 4cf542bbd74d44cc210344e8b01cf6f82ac07dcc Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Sat, 27 Mar 2010 22:11:26 +0300 Subject: [PATCH] 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 Signed-off-by: Pekka Enberg --- kvm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kvm.c b/kvm.c index d087016..04f13bb 100644 --- a/kvm.c +++ b/kvm.c @@ -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);