提交 d6fa4b77 编写于 作者: M M. Mohan Kumar 提交者: Aurelien Jarno

Check for invalid initrd file

When qemu is invoked with an invalid initrd file, it crashes. Following
patch prints a error message and exits if an invalid initrd is
specified. Includes changes suggested by JV.
Signed-off-by: NM. Mohan Kumar <mohan@in.ibm.com>
Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>
上级 f1dc58e0
...@@ -658,6 +658,12 @@ static void load_linux(void *fw_cfg, ...@@ -658,6 +658,12 @@ static void load_linux(void *fw_cfg,
} }
initrd_size = get_image_size(initrd_filename); initrd_size = get_image_size(initrd_filename);
if (initrd_size < 0) {
fprintf(stderr, "qemu: error reading initrd %s\n",
initrd_filename);
exit(1);
}
initrd_addr = (initrd_max-initrd_size) & ~4095; initrd_addr = (initrd_max-initrd_size) & ~4095;
initrd_data = qemu_malloc(initrd_size); initrd_data = qemu_malloc(initrd_size);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册