|
|
9ae3a8 |
From e53520a7e7f2cf2f78786c6c1ae906e70c26fd7e Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
Date: Tue, 6 Aug 2013 13:17:00 +0200
|
|
|
9ae3a8 |
Subject: [PATCH 07/28] qemu-option: Fix qemu_opts_find() for null id arguments
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1375795025-28674-2-git-send-email-armbru@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 52992
|
|
|
9ae3a8 |
O-Subject: [PATCH 7.0 qemu-kvm 1/6] qemu-option: Fix qemu_opts_find() for null id arguments
|
|
|
9ae3a8 |
Bugzilla: 980782
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Michal Novotny <minovotn@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Crashes when the first list member has an ID. Admittedly nonsensical
|
|
|
9ae3a8 |
reproducer:
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
$ qemu-system-x86_64 -nodefaults -machine id=foo -machine ""
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
|
|
|
9ae3a8 |
Message-id: 1372943363-24081-2-git-send-email-armbru@redhat.com
|
|
|
9ae3a8 |
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
|
|
|
9ae3a8 |
(cherry picked from commit 96bc97ebf350ec480b69082819cedb8850f46a0f)
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
util/qemu-option.c | 12 ++++--------
|
|
|
9ae3a8 |
1 file changed, 4 insertions(+), 8 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
util/qemu-option.c | 12 ++++--------
|
|
|
9ae3a8 |
1 files changed, 4 insertions(+), 8 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/util/qemu-option.c b/util/qemu-option.c
|
|
|
9ae3a8 |
index 8b74bf1..b6d2ac0 100644
|
|
|
9ae3a8 |
--- a/util/qemu-option.c
|
|
|
9ae3a8 |
+++ b/util/qemu-option.c
|
|
|
9ae3a8 |
@@ -736,16 +736,12 @@ QemuOpts *qemu_opts_find(QemuOptsList *list, const char *id)
|
|
|
9ae3a8 |
QemuOpts *opts;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
QTAILQ_FOREACH(opts, &list->head, next) {
|
|
|
9ae3a8 |
- if (!opts->id) {
|
|
|
9ae3a8 |
- if (!id) {
|
|
|
9ae3a8 |
- return opts;
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
- continue;
|
|
|
9ae3a8 |
+ if (!opts->id && !id) {
|
|
|
9ae3a8 |
+ return opts;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
- if (strcmp(opts->id, id) != 0) {
|
|
|
9ae3a8 |
- continue;
|
|
|
9ae3a8 |
+ if (opts->id && id && !strcmp(opts->id, id)) {
|
|
|
9ae3a8 |
+ return opts;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
- return opts;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
return NULL;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|