mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-09-21 11:41:40 +00:00
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>
This commit is contained in:
parent
3750dabc69
commit
1fa795a853
|
@ -130,7 +130,7 @@ PropertyInfo qdev_prop_bit = {
|
||||||
static uint64_t qdev_get_prop_mask64(Property *prop)
|
static uint64_t qdev_get_prop_mask64(Property *prop)
|
||||||
{
|
{
|
||||||
assert(prop->info == &qdev_prop_bit);
|
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)
|
static void bit64_prop_set(DeviceState *dev, Property *props, bool val)
|
||||||
|
|
Loading…
Reference in a new issue