[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 5/6] load_linux: report open kernel file & its s
From: |
li guang |
Subject: |
Re: [Qemu-devel] [PATCH 5/6] load_linux: report open kernel file & its size error |
Date: |
Tue, 05 Feb 2013 08:50:11 +0800 |
OK, will fix.
Thanks!
在 2013-02-04一的 18:20 +0000,Blue Swirl写道:
> On Mon, Feb 4, 2013 at 2:27 AM, liguang <address@hidden> wrote:
> > Signed-off-by: liguang <address@hidden>
> > ---
> > hw/pc.c | 14 +++++++++++---
> > 1 files changed, 11 insertions(+), 3 deletions(-)
> >
> > diff --git a/hw/pc.c b/hw/pc.c
> > index 01d00f6..0ccd775 100644
> > --- a/hw/pc.c
> > +++ b/hw/pc.c
> > @@ -652,12 +652,20 @@ static void load_linux(void *fw_cfg,
> > char *vmode;
> >
> > /* Align to 16 bytes as a paranoia measure */
> > - cmdline_size = (strlen(kernel_cmdline)+16) & ~15;
> > + cmdline_size = (strlen(kernel_cmdline)+16) & ~0xf;
>
> Here 15 is 16 - 1, so 0xf seems out of place. I'd use QEMU_ALIGN_UP().
>
> If you touch the line, please add spaces around '+'.
>
> >
> > /* load the kernel header */
> > f = fopen(kernel_filename, "rb");
> > - if (!f || !(kernel_size = get_file_size(f)) ||
> > - fread(header, 1, MIN(ARRAY_SIZE(header), kernel_size), f) !=
> > + if (!f) {
> > + fprintf(stderr, "can't open kernel image file\n");
>
> The error message from strerror(errno) would be interesting.
>
> > + exit(1);
> > + }
> > + kernel_size = get_file_size(f);
> > + if (kernel_size <= 0) {
> > + fprintf(stderr, "can't get size of kernel image file\n");
> > + exit(1);
> > + }
> > + if (fread(header, 1, MIN(ARRAY_SIZE(header), kernel_size), f) !=
> > MIN(ARRAY_SIZE(header), kernel_size)) {
> > fprintf(stderr, "qemu: could not load kernel '%s': %s\n",
> > kernel_filename, strerror(errno));
> > --
> > 1.7.2.5
> >
> >
- [Qemu-devel] [PATCH 0/6] change acpi numa info format passed from qemu to seabios, liguang, 2013/02/03
- [Qemu-devel] [PATCH 1/6] pc/bios: move common BIOS_CFG_IOPORT into fw_cfg.h, liguang, 2013/02/03
- [Qemu-devel] [PATCH 6/6] load_linux: change kernel header size allocation, liguang, 2013/02/03
- [Qemu-devel] [PATCH 5/6] load_linux: report open kernel file & its size error, liguang, 2013/02/03
- [Qemu-devel] [PATCH 2/6] pc/numa: refactor bios_init function, liguang, 2013/02/03
- [Qemu-devel] [PATCH 3/6] bitops: change BITS_TO_LONGS, liguang, 2013/02/03
- [Qemu-devel] [PATCH 4/6] pc: format load_linux(), liguang, 2013/02/03
- [Qemu-devel] [seabios][PATCH 2/2] acpi: change numa data format from fw_cfg interface, liguang, 2013/02/03
- [Qemu-devel] [seabios][PATCH 1/2] move all acpi-table related definitions to acpi.h, liguang, 2013/02/03