diff options
author | Danny Al-Gaaf <danny.al-gaaf@bisect.de> | 2013-05-13 16:19:46 +0200 |
---|---|---|
committer | Danny Al-Gaaf <danny.al-gaaf@bisect.de> | 2013-05-14 18:39:32 +0200 |
commit | 21489acffebbcb2663e8a15e988f8902c4e689e6 (patch) | |
tree | adc1bb8f09cdf8c481495490d948ff157d2deee4 /src/rbd.cc | |
parent | 3e446825193a3bdc613445f5e12a58ce70ab7d5f (diff) | |
download | ceph-21489acffebbcb2663e8a15e988f8902c4e689e6.tar.gz |
src/rbd.cc: use 64-bits to shift 'order'
CID 1019568 (#1 of 1): Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
overflow_before_widen: Potentially overflowing expression "1 << *order" with
type "int" (32 bits, signed) is evaluated using 32-bit arithmetic before being
used in a context which expects an expression of type "uint64_t" (64 bits,
unsigned). To avoid overflow, cast the left operand to "uint64_t" before
performing the left shift.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Diffstat (limited to 'src/rbd.cc')
-rw-r--r-- | src/rbd.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rbd.cc b/src/rbd.cc index 3e586bd4dcb..5e7389162f2 100644 --- a/src/rbd.cc +++ b/src/rbd.cc @@ -1294,7 +1294,7 @@ static int do_import(librbd::RBD &rbd, librados::IoCtx& io_ctx, bool from_stdin = !strcmp(path, "-"); if (from_stdin) { fd = 0; - size = 1 << *order; + size = 1ULL << *order; } else { fd = open(path, O_RDONLY); |