From: Peter Maydell Date: Fri, 23 Aug 2013 16:35:45 +0000 (+0100) Subject: block/qcow2.h: Avoid "1LL << 63" (shifts into sign bit) X-Git-Tag: v1.7.0-rc0~136^2~20 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=127c84e1a52f11bf418cc2d3bf804da5091a190a;p=qemu.git block/qcow2.h: Avoid "1LL << 63" (shifts into sign bit) The expression "1LL << 63" tries to shift the 1 into the sign bit of a 'long long', which provokes a clang sanitizer warning: runtime error: left shift of 1 by 63 places cannot be represented in type 'long long' Use "1ULL << 63" as the definition of QCOW_OFLAG_COPIED instead to avoid this. For consistency, we also update the other QCOW_OFLAG definitions to use the ULL suffix rather than LL, though only the shift by 63 is undefined behaviour. Signed-off-by: Peter Maydell Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --- diff --git a/block/qcow2.h b/block/qcow2.h index dba977141..365a17e4e 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -40,11 +40,11 @@ #define QCOW_MAX_CRYPT_CLUSTERS 32 /* indicate that the refcount of the referenced cluster is exactly one. */ -#define QCOW_OFLAG_COPIED (1LL << 63) +#define QCOW_OFLAG_COPIED (1ULL << 63) /* indicate that the cluster is compressed (they never have the copied flag) */ -#define QCOW_OFLAG_COMPRESSED (1LL << 62) +#define QCOW_OFLAG_COMPRESSED (1ULL << 62) /* The cluster reads as all zeros */ -#define QCOW_OFLAG_ZERO (1LL << 0) +#define QCOW_OFLAG_ZERO (1ULL << 0) #define REFCOUNT_SHIFT 1 /* refcount size is 2 bytes */