[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Qemu-block] [PATCH for-2.8] hbitmap: Fix the serializa
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [Qemu-block] [PATCH for-2.8] hbitmap: Fix the serialization granularity's type |
Date: |
Tue, 8 Nov 2016 16:36:31 +0000 |
User-agent: |
Mutt/1.7.1 (2016-10-04) |
On Mon, Nov 07, 2016 at 05:39:21PM +0100, Max Reitz wrote:
> This function returns a uint64_t, so it should not truncate its result
> by performing a plain int calculation.
>
> Signed-off-by: Max Reitz <address@hidden>
> ---
> util/hbitmap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/util/hbitmap.c b/util/hbitmap.c
> index 5d1a21c..c57be76 100644
> --- a/util/hbitmap.c
> +++ b/util/hbitmap.c
> @@ -401,7 +401,7 @@ uint64_t hbitmap_serialization_granularity(const HBitmap
> *hb)
> {
> /* Require at least 64 bit granularity to be safe on both 64 bit and 32
> bit
> * hosts. */
> - return 64 << hb->granularity;
> + return UINT64_C(64) << hb->granularity;
> }
Another instance that should be fixed:
uint64_t start = QEMU_ALIGN_UP(num_elements, 1 << hb->granularity);
signature.asc
Description: PGP signature