summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>2015-06-18 08:55:49 +0200
committerLoic Dachary <ldachary@redhat.com>2015-09-02 20:09:40 +0200
commit3dfca4f3106260e75019e064dfd077e21ba8199a (patch)
tree281db98475eaf6cfe103d1a792cf85c36c5d8719
parent715443661c00558fe32f004a4be5f93f341b6e59 (diff)
downloadgf-complete-3dfca4f3106260e75019e064dfd077e21ba8199a.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> (cherry picked from commit 98e5e37159f4c7634305aa65c9bc98a36488a4a9)
-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 6e75f5e..9bc7042 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++) {