Somehow or another, if someone were to feed a 1 into num_of_qps, then we'd have num_of_qps = 1 / 2 = 0, and later on, portindex % 0 -- a divide by zero condition. Make sure that can't happen. This resolves a coverity/clang warning. CC: Gil Rockah <gilr@xxxxxxxxxxxx> Signed-off-by: Jarod Wilson <jarod@xxxxxxxxxx> --- src/perftest_resources.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/perftest_resources.c b/src/perftest_resources.c index 7e982e9..959a5df 100755 --- a/src/perftest_resources.c +++ b/src/perftest_resources.c @@ -1830,6 +1830,8 @@ int ctx_modify_dc_qp_to_init(struct ibv_qp *qp,struct perftest_parameters *user_ if (user_param->duplex || user_param->tst == LAT) { num_of_qps /= 2; + if (num_of_qps < 2) + num_of_qps = 2; num_of_qps_per_port = num_of_qps / 2; } @@ -1896,6 +1898,8 @@ int ctx_modify_qp_to_init(struct ibv_qp *qp,struct perftest_parameters *user_par if ( user_param->use_xrc && (user_param->duplex || user_param->tst == LAT)) { num_of_qps /= 2; + if (num_of_qps < 2) + num_of_qps = 2; num_of_qps_per_port = num_of_qps / 2; } -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html