From: Gonglei Date: Tue, 23 Jun 2015 01:53:05 +0000 (+0800) Subject: qdev: fix OVERFLOW_BEFORE_WIDEN X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~209^2~93^2~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1fa795a853255fcc93e5d3e2a92d161a2ed96eb8;p=sdk%2Femulator%2Fqemu.git qdev: fix OVERFLOW_BEFORE_WIDEN 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 --- diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index a1606deaca..f78b335816 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)