From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Anthony Liguori <aliguori@us.ibm.com>,
Markus Armbruster <armbru@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH 1/6] pc_sysfw: Check for qemu_find_file() failure
Date: Fri, 4 Jan 2013 14:55:45 +0100 [thread overview]
Message-ID: <1357307750-1966-2-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1357307750-1966-1-git-send-email-stefanha@redhat.com>
From: Markus Armbruster <armbru@redhat.com>
pc_fw_add_pflash_drv() ignores qemu_find_file() failure, and happily
creates a drive without a medium.
When pc_system_flash_init() asks for its size, bdrv_getlength() fails
with -ENOMEDIUM, which isn't checked either. It fails relatively
cleanly only because -ENOMEDIUM isn't a multiple of 4096:
$ qemu-system-x86_64 -S -vnc :0 -bios nonexistant
qemu: PC system firmware (pflash) must be a multiple of 0x1000
[Exit 1 ]
Fix by handling the qemu_find_file() failure.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
hw/pc_sysfw.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/pc_sysfw.c b/hw/pc_sysfw.c
index 87e1fa9..7567593 100644
--- a/hw/pc_sysfw.c
+++ b/hw/pc_sysfw.c
@@ -84,6 +84,10 @@ static void pc_fw_add_pflash_drv(void)
bios_name = BIOS_FILENAME;
}
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
+ if (!filename) {
+ error_report("Can't open BIOS image %s", bios_name);
+ exit(1);
+ }
opts = drive_add(IF_PFLASH, -1, filename, "readonly=on");
--
1.8.0.2
next prev parent reply other threads:[~2013-01-04 13:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-04 13:55 [Qemu-devel] [PULL 0/6] Trivial patches for 18 December 2012 to 4 January 2013 Stefan Hajnoczi
2013-01-04 13:55 ` Stefan Hajnoczi [this message]
2013-01-04 13:55 ` [Qemu-devel] [PATCH 2/6] pseries: Remove unneeded include statement (fixes MinGW builds) Stefan Hajnoczi
2013-01-04 13:55 ` [Qemu-devel] [PATCH 3/6] Remove --sparc_cpu option from the configure list Stefan Hajnoczi
2013-01-04 13:55 ` [Qemu-devel] [PATCH 4/6] hw/mcf5206: Reduce size of lookup table Stefan Hajnoczi
2013-01-04 13:55 ` [Qemu-devel] [PATCH 5/6] linux-user/syscall.c: remove forward declarations Stefan Hajnoczi
2013-01-04 13:55 ` [Qemu-devel] [PATCH 6/6] spice: drop incorrect vm_change_state_handler() opaque Stefan Hajnoczi
2013-01-04 20:21 ` [Qemu-devel] [PULL 0/6] Trivial patches for 18 December 2012 to 4 January 2013 Anthony Liguori
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=1357307750-1966-2-git-send-email-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=armbru@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).