diff options
author | Danny Al-Gaaf <danny.al-gaaf@bisect.de> | 2015-06-18 09:01:37 +0200 |
---|---|---|
committer | Danny Al-Gaaf <danny.al-gaaf@bisect.de> | 2015-06-18 09:01:37 +0200 |
commit | 2f6db512fb83f2d8e84e8097ebd2595c6ec8f8eb (patch) | |
tree | f1145b294afc7dbe72b0482e94f7f0bff5026e01 | |
parent | 1aef8694bc62a053e35cc1c74c67f1d15d8d1b6a (diff) | |
download | gf-complete-2f6db512fb83f2d8e84e8097ebd2595c6ec8f8eb.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>
-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 7f9f965..de231db 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; |