diff options
author | Danny Al-Gaaf <danny.al-gaaf@bisect.de> | 2015-06-18 09:01:37 +0200 |
---|---|---|
committer | Loic Dachary <ldachary@redhat.com> | 2015-09-02 20:09:40 +0200 |
commit | e6d87f742dd62b3c7206d024271b4ef29de21a9e (patch) | |
tree | 4795033da8a8298fe22e0bda46e9af0f0bb01cb3 | |
parent | c4a150b87e1c122f204c141c7be415046e1882fe (diff) | |
download | gf-complete-e6d87f742dd62b3c7206d024271b4ef29de21a9e.tar.gz |
gf_w64.c: fix integer overflow
Fix for Coverity issue (from Ceph):
CID 1193089 (#1 of 1): Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
overflow_before_widen: Potentially overflowing expression 1 << g_r with type
int (32 bits, signed) is evaluated using 32-bit arithmetic, and then used in
a context that expects an expression of type uint64_t (64 bits, unsigned).
CID 1193090 (#1 of 1): Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
overflow_before_widen: Potentially overflowing expression 1 << g_s with type
int (32 bits, signed) is evaluated using 32-bit arithmetic, and then used in
a context that expects an expression of type uint64_t (64 bits, unsigned).
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
(cherry picked from commit 2f6db512fb83f2d8e84e8097ebd2595c6ec8f8eb)
-rw-r--r-- | src/gf_w64.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gf_w64.c b/src/gf_w64.c index 4776cf9..75e0c36 100644 --- a/src/gf_w64.c +++ b/src/gf_w64.c @@ -840,8 +840,8 @@ void gf_w64_group_multiply_region(gf_t *gf, void *src, void *dest, gf_val_64_t v d64 = (uint64_t *) rd.d_start; dtop = (uint64_t *) rd.d_top; - smask = (1 << g_s) - 1; - rmask = (1 << g_r) - 1; + smask = ((uint64_t)1 << g_s) - 1; + rmask = ((uint64_t)1 << g_r) - 1; while (d64 < dtop) { a64 = *s64; |