From patchwork Fri Jun 26 13:45:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 488816 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2BC7A14028F for ; Fri, 26 Jun 2015 23:46:46 +1000 (AEST) Received: from localhost ([::1]:60091 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8Txs-00070V-Cc for incoming@patchwork.ozlabs.org; Fri, 26 Jun 2015 09:46:44 -0400 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 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 084E33070BE; Fri, 26 Jun 2015 13:45:48 +0000 (UTC) Received: from redhat.com (ovpn-116-135.ams2.redhat.com [10.36.116.135]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id t5QDjjIc030302; Fri, 26 Jun 2015 09:45:45 -0400 Date: Fri, 26 Jun 2015 15:45:44 +0200 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org 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-Disposition: inline In-Reply-To: <1435326248-24291-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Maydell , Eduardo Habkost , Markus Armbruster , Gonglei , Gerd Hoffmann , Paolo Bonzini Subject: [Qemu-devel] [PULL 02/17] qdev: fix OVERFLOW_BEFORE_WIDEN X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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)