[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH trivial] acpi: actually require either data= or file
From: |
Michael Tokarev |
Subject: |
[Qemu-devel] [PATCH trivial] acpi: actually require either data= or file= for -acpitable |
Date: |
Mon, 3 Jun 2013 13:20:43 +0400 |
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 <address@hidden>
---
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
- [Qemu-devel] [PATCH trivial] acpi: actually require either data= or file= for -acpitable,
Michael Tokarev <=