[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 06/26] block/qcow2.h: Avoid "1LL << 63" (shifts into
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 06/26] block/qcow2.h: Avoid "1LL << 63" (shifts into sign bit) |
Date: |
Fri, 30 Aug 2013 16:30:31 +0200 |
From: Peter Maydell <address@hidden>
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 <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/qcow2.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/block/qcow2.h b/block/qcow2.h
index dba9771..365a17e 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 */
--
1.8.1.4
- [Qemu-devel] [PULL 00/26] Block patches, Kevin Wolf, 2013/08/30
- [Qemu-devel] [PULL 01/26] qcow2: Change default for new images to compat=1.1, Kevin Wolf, 2013/08/30
- [Qemu-devel] [PULL 03/26] qapi-types.py: Split off generate_struct_fields(), Kevin Wolf, 2013/08/30
- [Qemu-devel] [PULL 06/26] block/qcow2.h: Avoid "1LL << 63" (shifts into sign bit),
Kevin Wolf <=
- [Qemu-devel] [PULL 04/26] Revert "block: Disable driver-specific options for 1.6", Kevin Wolf, 2013/08/30
- [Qemu-devel] [PULL 02/26] block: Remove redundant assertion, Kevin Wolf, 2013/08/30
- [Qemu-devel] [PULL 05/26] qemu-iotests: Update reference output for 051, Kevin Wolf, 2013/08/30
- [Qemu-devel] [PULL 07/26] add skeleton for BSD licensed "raw" BlockDriver, Kevin Wolf, 2013/08/30
- [Qemu-devel] [PULL 08/26] raw_bsd: emit debug events in bdrv_co_readv() and bdrv_co_writev(), Kevin Wolf, 2013/08/30
- [Qemu-devel] [PULL 09/26] raw_bsd: add raw_create(), Kevin Wolf, 2013/08/30
- [Qemu-devel] [PULL 10/26] raw_bsd: introduce "special members", Kevin Wolf, 2013/08/30
- [Qemu-devel] [PULL 11/26] raw_bsd: add raw_create_options, Kevin Wolf, 2013/08/30
- [Qemu-devel] [PULL 12/26] raw_bsd: register bdrv_raw, Kevin Wolf, 2013/08/30
- [Qemu-devel] [PULL 13/26] switch raw block driver from "raw.o" to "raw_bsd.o", Kevin Wolf, 2013/08/30