qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH trivial] acpi: actually require either data= or file= for -acpitable
@ 2013-06-03  9:20 Michael Tokarev
  2013-06-03 12:34 ` Eric Blake
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Tokarev @ 2013-06-03  9:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Michael Tokarev

Initially the code ensured that we have exactly one of
data= or file= option for -acpitable.  But after some
transformations, the condition becomes

  if (has_data == has_file) { error }

to mean, probably, that both should not be set at the same
time.  But this condition does not cover the case when
neither is set, and we generate bogus acpi table in this
case.

Instead, check if sum of the two is exactly 1.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/acpi/core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/acpi/core.c b/hw/acpi/core.c
index 42eeace..2815d8c 100644
--- a/hw/acpi/core.c
+++ b/hw/acpi/core.c
@@ -249,7 +249,7 @@ void acpi_table_add(const QemuOpts *opts, Error **errp)
     if (err) {
         goto out;
     }
-    if (hdrs->has_file == hdrs->has_data) {
+    if (!hdrs->has_file + !hdrs->has_data != 1) {
         error_setg(&err, "'-acpitable' requires one of 'data' or 'file'");
         goto out;
     }
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-06-04  3:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-03  9:20 [Qemu-devel] [PATCH trivial] acpi: actually require either data= or file= for -acpitable Michael Tokarev
2013-06-03 12:34 ` Eric Blake
2013-06-03 12:42   ` Michael Tokarev
2013-06-03 18:19     ` Laszlo Ersek
2013-06-04  3:36       ` Michael Tokarev

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).