aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2010-11-23 13:32:31 +0000
committerDaniel P. Berrange <berrange@redhat.com>2010-11-23 15:18:03 +0000
commitf86c7801e921afd09aa4db0837796f84b08aae0b (patch)
tree7d384a417a19623b8a4860b8dc07b311139d7de1
parentFix error handling in virsh when listing storage volumes (diff)
downloadlibvirt-f86c7801e921afd09aa4db0837796f84b08aae0b.tar.gz
libvirt-f86c7801e921afd09aa4db0837796f84b08aae0b.tar.bz2
libvirt-f86c7801e921afd09aa4db0837796f84b08aae0b.zip
Fix 32-bit int truncation in QED header check
* src/util/memory.c: Avoid 32-bit truncation extracting a 64bit int
-rw-r--r--src/util/storage_file.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/util/storage_file.c b/src/util/storage_file.c
index 2612eb650..4faa99d8b 100644
--- a/src/util/storage_file.c
+++ b/src/util/storage_file.c
@@ -437,14 +437,14 @@ qedGetHeaderUL(const unsigned char *loc)
static unsigned long long
qedGetHeaderULL(const unsigned char *loc)
{
- return ( ((unsigned long)loc[7] << 56)
- | ((unsigned long)loc[6] << 48)
- | ((unsigned long)loc[5] << 40)
- | ((unsigned long)loc[4] << 32)
- | ((unsigned long)loc[3] << 24)
- | ((unsigned long)loc[2] << 16)
- | ((unsigned long)loc[1] << 8)
- | ((unsigned long)loc[0] << 0));
+ return ( ((unsigned long long)loc[7] << 56)
+ | ((unsigned long long)loc[6] << 48)
+ | ((unsigned long long)loc[5] << 40)
+ | ((unsigned long long)loc[4] << 32)
+ | ((unsigned long long)loc[3] << 24)
+ | ((unsigned long long)loc[2] << 16)
+ | ((unsigned long long)loc[1] << 8)
+ | ((unsigned long long)loc[0] << 0));
}
static int