From: Michael Tokarev <mjt@tls.msk.ru>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH +STABLE-0.14] exit if -drive specified is invalid instead of ignoring the "wrong" -drive
Date: Thu, 17 Mar 2011 17:28:15 +0300 [thread overview]
Message-ID: <4D821A7F.9000204@msgid.tls.msk.ru> (raw)
In-Reply-To: <m3r5a597om.fsf@blackfin.pond.sub.org>
17.03.2011 16:51, Markus Armbruster wrote:
> Michael Tokarev <mjt@tls.msk.ru> writes:
>
>> Trivial patch. I've sent it yesterday but somehow it didn't
>> reach the list.
>>
>> This fixes the problem when qemu continues even if -drive specification
>> is somehow invalid, resulting in a mess. Applicable for both current
>> master and for stable-0.14 (and 0.13 and 0.12 as well).
>
> Note patch doesn't apply to 0.12 and 0.13.
Yes it doesn't, since to 0.14 the code changed.
What I mean is that the same problem exist in
earlier versions too. I'll apply a change of
this effect to 0.12.5 as used in Debian now,
something like the one below.
[]
> What about all the other unchecked drive_add() calls in main()?
These are much less worrisome - they fail only of the
internal definitions of options are incorrect, which
should never happen. For example:
case QEMU_OPTION_hdd:
drive_add(IF_DEFAULT, popt->index - QEMU_OPTION_hda, optarg,
HD_OPTS);
There, optarg is just a filename, and HD_OPTS is
defined like this:
#define HD_OPTS "media=disk"
So it should not fail when parsing options, only
when trying to interpret and actually open the
filename, which happens much later in the game.
Thanks,
/mjt
For 0.12 and 0.13:
diff --git a/vl.c b/vl.c
index 77677e8..069a1df 100644
--- a/vl.c
+++ b/vl.c
@@ -5025,7 +5025,8 @@ int main(int argc, char **argv, char **envp)
drive_add(optarg, HD_ALIAS, popt->index - QEMU_OPTION_hda);
break;
case QEMU_OPTION_drive:
- drive_add(NULL, "%s", optarg);
+ if (drive_add(NULL, "%s", optarg) == NULL)
+ exit(1);
break;
case QEMU_OPTION_set:
if (qemu_set_option(optarg) != 0)
next prev parent reply other threads:[~2011-03-17 14:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-17 7:58 [Qemu-devel] [PATCH +STABLE-0.14] exit if -drive specified is invalid instead of ignoring the "wrong" -drive Michael Tokarev
2011-03-17 13:51 ` Markus Armbruster
2011-03-17 14:28 ` Michael Tokarev [this message]
2011-03-17 15:35 ` Markus Armbruster
2011-03-17 15:04 ` Kevin Wolf
2011-03-17 15:33 ` Markus Armbruster
2011-03-17 15:41 ` Kevin Wolf
2011-03-17 15:49 ` Michael Tokarev
2011-03-17 15:55 ` Kevin Wolf
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=4D821A7F.9000204@msgid.tls.msk.ru \
--to=mjt@tls.msk.ru \
--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 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.