From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akSli-0002EH-Fs for qemu-devel@nongnu.org; Mon, 28 Mar 2016 04:43:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1akSlf-0001hF-9y for qemu-devel@nongnu.org; Mon, 28 Mar 2016 04:43:26 -0400 Received: from mail.weilnetz.de ([37.221.199.173]:60412) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akSlf-0001h4-3l for qemu-devel@nongnu.org; Mon, 28 Mar 2016 04:43:23 -0400 References: <1459149797-24108-1-git-send-email-marcel@redhat.com> From: Stefan Weil Message-ID: <56F8EE96.2090709@weilnetz.de> Date: Mon, 28 Mar 2016 10:43:02 +0200 MIME-Version: 1.0 In-Reply-To: <1459149797-24108-1-git-send-email-marcel@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="c3XIloaxrghslmUBFqHQ5c41Fo6gRiaS5" Subject: Re: [Qemu-devel] [PATCH] pci: fix compilation warnings List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcel Apfelbaum , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, armbru@redhat.com, mst@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --c3XIloaxrghslmUBFqHQ5c41Fo6gRiaS5 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable Am 28.03.2016 um 09:23 schrieb Marcel Apfelbaum: > Fix 'error: shift exponent -1 is negative' warning > by adding a corresponding assert. > > Reported-by: Peter Maydell > Signed-off-by: Markus Armbruster > Signed-off-by: Marcel Apfelbaum > --- > hw/pci/pci.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/hw/pci/pci.c b/hw/pci/pci.c > index e67664d..a1d41aa 100644 > --- a/hw/pci/pci.c > +++ b/hw/pci/pci.c > @@ -163,11 +163,15 @@ int pci_bar(PCIDevice *d, int reg) > =20 > static inline int pci_irq_state(PCIDevice *d, int irq_num) > { > + assert(irq_num >=3D 0); > + > return (d->irq_state >> irq_num) & 0x1; > } > =20 > static inline void pci_set_irq_state(PCIDevice *d, int irq_num, int le= vel) > { > + assert(irq_num >=3D 0); > + > d->irq_state &=3D ~(0x1 << irq_num); > d->irq_state |=3D level << irq_num; > } Do we use negative values for irq_num anywhere? If not, using an unsigned irq_num might be a better solution. Stefan --c3XIloaxrghslmUBFqHQ5c41Fo6gRiaS5 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJW+O6nAAoJEOCMIdVndFCt4bwP/RPgRHx/fQ8GcDvzMA9D5paM sH4R5fcZM1SVzflLqlhiHjlIp3VrdnqPcQfc2SJEBnocZjQWiMEEjmsp8t9aJQcJ nhNHt/5RTTLQvMG1CINMKQ7fui9BL5zcSp+USplmYD24PzKG85ruun5AFoJLGUKm sow6CssaJaC58SpqAZ/d25DLi9DeExJIJOC+OJUC99PJPjhhzb507fPL8iK3duEf gmeMIu2xlK/MShHZcpVIPo3ZBRADktMAIH+hch4pNZ1SO0rnQICLPyOGi6Z1u+OV qGG/MGjpidQKLwDRwHbLV0q8r31BfvsXp6FBco91xJt7de1JJnWseIigcBCdQVsg UPYFQwLsyWjjPYd7kkRb/mzJePMn6sstDFE0kdK3FexyvKLNG5iEXCcnUaMkKpID 5HiRMzxITsxTWw1iHqG5xOI6cTWeQ7IWjA5VZUv/SOoaQBT9HEKatX1YigG4V07O xg7IJpDrbZV4mHq5iifLvyJvQwTcyhvGqvfGxWEExT2Z3zJs97m3QIdgKZo9LBgk qlQz0oBmdQX+MOf9zr8sASV/SiBzHbgeMN1BNvwbcFw6+4LZKcCbLyr2hwkoT76b RgvXGpivXEkR+Pp//8lDN8CMgRlPorts3Z+3ncGDm/mW2snPC6U8UMjga79Mw0bt EFvbmoMtLPcUToGN53ol =ajNG -----END PGP SIGNATURE----- --c3XIloaxrghslmUBFqHQ5c41Fo6gRiaS5--