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>
master
Danny Al-Gaaf 2015-06-18 09:01:37 +02:00
parent 1aef8694bc
commit 2f6db512fb
1 changed files with 2 additions and 2 deletions

View File

@ -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;