From: "M. Mohan Kumar" <mohan@in.ibm.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Check for invalid initrd file
Date: Thu, 4 Mar 2010 14:32:24 +0530 [thread overview]
Message-ID: <201003041432.24973.mohan@in.ibm.com> (raw)
From c5dca54f67ec6aac16c6c5e09958417b2b3ee5a1 Mon Sep 17 00:00:00 2001
From: M. Mohan Kumar <mohan@in.ibm.com>
Date: Thu, 4 Mar 2010 14:23:07 +0530
Subject: [PATCH] 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.
Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
---
hw/pc.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index 4f6a522..551c901 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -669,6 +669,12 @@ static void load_linux(void *fw_cfg,
}
initrd_size = get_image_size(initrd_filename);
+ if (initrd_size < 0) {
+ fprintf(stderr, "qemu: initrd %s does not exist\n",
+ initrd_filename);
+ exit(1);
+ }
+
initrd_addr = (initrd_max-initrd_size) & ~4095;
initrd_data = qemu_malloc(initrd_size);
--
1.6.6.1
--
M. Mohan Kumar,
Linux Technology Center, IBM India
next reply other threads:[~2010-03-04 9:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-04 9:02 M. Mohan Kumar [this message]
2010-03-04 18:16 ` [Qemu-devel] [PATCH] Check for invalid initrd file jvrao
-- strict thread matches above, loose matches on Subject: below --
2010-04-12 4:31 M. Mohan Kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201003041432.24973.mohan@in.ibm.com \
--to=mohan@in.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.