diff options
author | M. Mohan Kumar <mohan@in.ibm.com> | 2010-04-12 10:01:33 +0530 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2010-04-19 00:07:10 +0200 |
commit | d6fa4b77fb8f27ac84cf23fb1e15016673d98a47 (patch) | |
tree | 9194966201291d7ec13faaf124c8b9ee942700f3 | |
parent | f1dc58e07decfa21f6141d6c441008d4b8b83331 (diff) | |
download | qemu-d6fa4b77fb8f27ac84cf23fb1e15016673d98a47.tar.gz qemu-d6fa4b77fb8f27ac84cf23fb1e15016673d98a47.tar.bz2 qemu-d6fa4b77fb8f27ac84cf23fb1e15016673d98a47.zip |
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: M. Mohan Kumar <mohan@in.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
-rw-r--r-- | hw/pc.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -658,6 +658,12 @@ static void load_linux(void *fw_cfg, } 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_data = qemu_malloc(initrd_size); |