On Mon, Feb 4, 2013 at 2:27 AM, liguang lig.fnst@cn.fujitsu.com wrote:
Signed-off-by: liguang lig.fnst@cn.fujitsu.com
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