summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>2015-06-18 08:55:49 +0200
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>2015-06-18 08:55:49 +0200
commit98e5e37159f4c7634305aa65c9bc98a36488a4a9 (patch)
tree5856fdff29c3812e440dbae31bb2295d51609f55
parent7972291e1f1fb68d05332cccd46a738b0d83b1be (diff)
downloadgf-complete-98e5e37159f4c7634305aa65c9bc98a36488a4a9.tar.gz
gf_w64.c: fix integer overflow
Fix for Coverity issue (from Ceph): CID 1193086 (#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). Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
-rw-r--r--src/gf_w64.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gf_w64.c b/src/gf_w64.c
index 91f53d6..74e5e9e 100644
--- a/src/gf_w64.c
+++ b/src/gf_w64.c
@@ -994,7 +994,7 @@ int gf_w64_group_init(gf_t *gf)
gd->reduce = gd->shift + (1 << g_s);
gd->reduce[0] = 0;
- for (i = 0; i < (1 << g_r); i++) {
+ for (i = 0; i < ((uint64_t)1 << g_r); i++) {
p = 0;
index = 0;
for (j = 0; j < g_r; j++) {