From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjTxj-0001SD-P0 for qemu-devel@nongnu.org; Mon, 03 Jun 2013 08:34:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UjTxd-0005IJ-Ur for qemu-devel@nongnu.org; Mon, 03 Jun 2013 08:34:11 -0400 Message-ID: <51AC8D38.90205@redhat.com> Date: Mon, 03 Jun 2013 06:34:00 -0600 From: Eric Blake MIME-Version: 1.0 References: <1370251243-20352-1-git-send-email-mjt@msgid.tls.msk.ru> In-Reply-To: <1370251243-20352-1-git-send-email-mjt@msgid.tls.msk.ru> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2QFMDPOUJUTTPOPOJMAGB" Subject: Re: [Qemu-devel] [PATCH trivial] acpi: actually require either data= or file= for -acpitable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Tokarev Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2QFMDPOUJUTTPOPOJMAGB Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 06/03/2013 03:20 AM, Michael Tokarev wrote: > Initially the code ensured that we have exactly one of > data=3D or file=3D option for -acpitable. But after some > transformations, the condition becomes >=20 > if (has_data =3D=3D has_file) { error } >=20 > 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. >=20 > Instead, check if sum of the two is exactly 1. >=20 > Signed-off-by: Michael Tokarev > --- > hw/acpi/core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > 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 **e= rrp) > if (err) { > goto out; > } > - if (hdrs->has_file =3D=3D hdrs->has_data) { NACK. hdrs->has_file and hdrs->has_data are both bool. Pre-patch, the table of possible combinations is: false =3D=3D false =3D> error message, zero given false =3D=3D true =3D> okay, exactly one given true =3D=3D false =3D> okay, exactly one given true =3D=3D true =3D> error message, two given which is already what you want. > + if (!hdrs->has_file + !hdrs->has_data !=3D 1) { Meanwhile, the post-patch logic is harder to read, in my opinion. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2QFMDPOUJUTTPOPOJMAGB Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJRrI04AAoJEKeha0olJ0NqEOYIAI7QDD4/dNnkfsWHUnvELZvw 9nc8WFyb4oBTlzykbAonzbPLF3WwLuo/k4bSF6l9Woz1NdVwhH6udIWa/LVYKxDP VoG+1A1hIqJIbORR94JJmlZE0h6mvwcb8rHSdDEAgJ/mN3aV4SVT3ZXApV59mQP0 ip+7OVeoXg1PyYQGeVrJ2gVLExDkuFO2ghU9xzHhcDjhoBHvqq49KtGMR33bpmMY rTwgFrXo4WkaK/cNxy9UkoDge41DYYnSb+hq0ovauGPK3TKJ33+5eJ+HW6AgC33k VPcwwQ397KTYAlVcVYBfYQHMUWvrKtfxwPqACK3R1CD7Ivpq45R8WmC3Myf9fqY= =VDwL -----END PGP SIGNATURE----- ------enig2QFMDPOUJUTTPOPOJMAGB--