diff options
author | Gonglei | 2015-06-23 03:53:05 +0200 |
---|---|---|
committer | Michael S. Tsirkin | 2015-06-23 08:14:13 +0200 |
commit | 1fa795a853255fcc93e5d3e2a92d161a2ed96eb8 (patch) | |
tree | 02cec5b7bd4a9e5c88bb2522a7d4516c0c95a935 /hw/core/qdev-properties.c | |
parent | virito-pci: fix OVERRUN problem (diff) | |
download | qemu-1fa795a853255fcc93e5d3e2a92d161a2ed96eb8.tar.gz qemu-1fa795a853255fcc93e5d3e2a92d161a2ed96eb8.tar.xz qemu-1fa795a853255fcc93e5d3e2a92d161a2ed96eb8.zip |
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 <kraxel@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/core/qdev-properties.c')
-rw-r--r-- | hw/core/qdev-properties.c | 2 |
1 files changed, 1 insertions, 1 deletions
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) |