linux/dim: Fix divide 0 in RDMA DIM.
Subsystems (2)
PATCH v2 1/1 linux/dim: Fix divide 0 in RDMA DIM.
We hit a divide 0 error in ofed 5.1.2.3.7.1. It is caused in rdma_dim_stats_compare() when prev->cpe_ratio == 0.
dim.c and rdma_dim.c in ofed share same code with upstream. We check the 0 case in IS_SIGNIFICANT_DIFF(), and do not change decision order.
--- include/linux/dim.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/dim.h +1 -1
@@ -21,7 +21,7 @@* We consider 10% difference as significant. */ #define IS_SIGNIFICANT_DIFF (val, ref) \ - (((100UL * abs((val) - (ref))) / (ref)) > 10) + ((ref) && (((100UL * abs((val) - (ref))) / (ref)) > 10))/* * Calculate the gap between two values.
Signature · 1 line
2.30.1 (Apple Git-130)
Quoted 11 lines · Tao Liu
We hit a divide 0 error in ofed 5.1.2.3.7.1. It is caused in
rdma_dim_stats_compare()whenprev->cpe_ratio== 0.
dim.candrdma_dim.cin ofed share same code with upstream. We check the 0 case inIS_SIGNIFICANT_DIFF(), and do not change decision order.Signed-off-by Tao Liu <[email protected]>--- include/linux/dim.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
I liked the commit message from v1 more.
It had proper kernel panic dump together with Fixes line.
https://lore.kernel.org/all/[email protected]
The change itself is ok.
Thanks,
Max Gurtovoy
Reviewed-byQuoted 8 lines · Leon Romanovsky
Quoted 7 lines · Tao Liu
We hit a divide 0 error in ofed 5.1.2.3.7.1. It is caused in
rdma_dim_stats_compare()whenprev->cpe_ratio== 0.
dim.candrdma_dim.cin ofed share same code with upstream. We check the 0 case inIS_SIGNIFICANT_DIFF(), and do not change decision order.
Quoted 5 lines
Quoted 4 lines
Signed-off-by Tao Liu <[email protected]>--- include/linux/dim.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)I liked the commit message from v1 more.
I think you need to do a combination of the commit msg (remove the ofed notion):
"fix a divide 0 error in rdma_dim_stats_compare() when prev->cpe_ratio == 0.
CallTrace:
....
Fixes(...)"
Otherwise,
Looks good,
Quoted 7 lines
It had proper kernel panic dump together with Fixes line.
https://lore.kernel.org/all/[email protected]The change itself is ok.
Thanks,
Acked-by Leon Romanovsky <[email protected]>