[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] fix loading tiny kernels
From: |
Laurent Desnogues |
Subject: |
Re: [Qemu-devel] [PATCH] fix loading tiny kernels |
Date: |
Tue, 3 Feb 2009 10:05:38 +0100 |
On Tue, Feb 3, 2009 at 9:59 AM, René Rebe <address@hidden> wrote:
> Further testing / polishing the multi-boot kernel loading support I found
> the existing code fails to load unusual small kernels, less than 8192 bytes
> -
> for example the example multi-boot kernel shipped within GRUB that
> compiles to just 7121 bytes on my system.
>
> Signed-off-by: René Rebe <address@hidden>
>
> --- hw/pc.c (revision 6501)
> +++ hw/pc.c (working copy)
> @@ -554,7 +989,7 @@
> /* load the kernel header */
> f = fopen(kernel_filename, "rb");
> if (!f || !(kernel_size = get_file_size(f)) ||
> - fread(header, 1, 1024, f) != 1024) {
> + fread(header, 1, MIN(8192, kernel_size), f) != MIN(8192, kernel_size))
That's wrong: 'header' size is 1024 bytes.
Laurent