[PATCH perftest 18/23] perftest_resources: do 64-bit math setting tarr_size
From: Jarod Wilson <hidden>
Date: 2016-08-18 17:32:13
Subsystem:
the rest · Maintainer:
Linus Torvalds
Error: OVERFLOW_BEFORE_WIDEN: [#def28] perftest-3.0/src/perftest_resources.c:650: overflow_before_widen: Potentially overflowing expression "user_param->iters * user_param->num_of_qps" 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). perftest-3.0/src/perftest_resources.c:650: remediation: To avoid overflow, cast either "user_param->iters" or "user_param->num_of_qps" to type "uint64_t". CC: Gil Rockah <gilr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> Signed-off-by: Jarod Wilson <redacted> --- src/perftest_resources.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/perftest_resources.c b/src/perftest_resources.c
index 91c6d1e..7e982e9 100755
--- a/src/perftest_resources.c
+++ b/src/perftest_resources.c@@ -650,7 +650,7 @@ void alloc_ctx(struct pingpong_context *ctx,struct perftest_parameters *user_par ALLOCATE(user_param->port_by_qp, uint64_t, user_param->num_of_qps); - tarr_size = (user_param->noPeak) ? 1 : user_param->iters*user_param->num_of_qps; + tarr_size = (user_param->noPeak) ? 1UL : (uint64_t)user_param->iters*user_param->num_of_qps; ALLOCATE(user_param->tposted, cycles_t, tarr_size); memset(user_param->tposted, 0, sizeof(cycles_t)*tarr_size);
--
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html