qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-trivial] [Qemu-devel] [PATCH 2/2] qdev: fix OVERFLOW_BEFORE_WI


From: Markus Armbruster
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH 2/2] qdev: fix OVERFLOW_BEFORE_WIDEN
Date: Tue, 23 Jun 2015 09:37:59 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

<address@hidden> writes:

> From: Gonglei <address@hidden>
>
> 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 <address@hidden>
> Signed-off-by: Paolo Bonzini <address@hidden>
> Signed-off-by: Gonglei <address@hidden>
> ---
>  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)

In my opionion, the 0x in 0x1ull is pure noise :)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]