From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60347) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8Tx3-0005rQ-5b for qemu-devel@nongnu.org; Fri, 26 Jun 2015 09:45:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z8Twy-0001HT-NI for qemu-devel@nongnu.org; Fri, 26 Jun 2015 09:45:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32969) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8Twy-0001HF-I8 for qemu-devel@nongnu.org; Fri, 26 Jun 2015 09:45:48 -0400 Date: Fri, 26 Jun 2015 15:45:44 +0200 From: "Michael S. Tsirkin" Message-ID: <1435326248-24291-3-git-send-email-mst@redhat.com> References: <1435326248-24291-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1435326248-24291-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 02/17] qdev: fix OVERFLOW_BEFORE_WIDEN List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Eduardo Habkost , Markus Armbruster , Gonglei , Gerd Hoffmann , Paolo Bonzini From: Gonglei Potentially overflowing expression "1 << prop->bitnr" with type "int" (32 bits, signed) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type "uint64_t" (64 bits, unsigned). Cc: Gerd Hoffmann Signed-off-by: Paolo Bonzini Signed-off-by: Gonglei Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/core/qdev-properties.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index a1606de..f78b335 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -130,7 +130,7 @@ PropertyInfo qdev_prop_bit = { static uint64_t qdev_get_prop_mask64(Property *prop) { assert(prop->info == &qdev_prop_bit); - return 0x1 << prop->bitnr; + return 0x1ull << prop->bitnr; } static void bit64_prop_set(DeviceState *dev, Property *props, bool val) -- MST