summaryrefslogtreecommitdiffstats
path: root/lib/dim/rdma_dim.c
diff options
context:
space:
mode:
authorRoy Novich <royno@nvidia.com>2023-05-07 15:57:43 +0200
committerPaolo Abeni <pabeni@redhat.com>2023-05-09 11:06:45 +0200
commit162bd18eb55adf464a0fa2b4144b8d61c75ff7c2 (patch)
treef481210218bfe40d2c67074c592d5871e16db373 /lib/dim/rdma_dim.c
parentnet: mdio: mvusb: Fix an error handling path in mvusb_mdio_probe() (diff)
downloadlinux-162bd18eb55adf464a0fa2b4144b8d61c75ff7c2.tar.xz
linux-162bd18eb55adf464a0fa2b4144b8d61c75ff7c2.zip
linux/dim: Do nothing if no time delta between samples
Add return value for dim_calc_stats. This is an indication for the caller if curr_stats was assigned by the function. Avoid using curr_stats uninitialized over {rdma/net}_dim, when no time delta between samples. Coverity reported this potential use of an uninitialized variable. Fixes: 4c4dbb4a7363 ("net/mlx5e: Move dynamic interrupt coalescing code to include/linux") Fixes: cb3c7fd4f839 ("net/mlx5e: Support adaptive RX coalescing") Signed-off-by: Roy Novich <royno@nvidia.com> Reviewed-by: Aya Levin <ayal@nvidia.com> Reviewed-by: Saeed Mahameed <saeedm@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Reviewed-by: Michal Kubiak <michal.kubiak@intel.com> Link: https://lore.kernel.org/r/20230507135743.138993-1-tariqt@nvidia.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to '')
-rw-r--r--lib/dim/rdma_dim.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/dim/rdma_dim.c b/lib/dim/rdma_dim.c
index 15462d54758d..88f779486707 100644
--- a/lib/dim/rdma_dim.c
+++ b/lib/dim/rdma_dim.c
@@ -88,7 +88,8 @@ void rdma_dim(struct dim *dim, u64 completions)
nevents = curr_sample->event_ctr - dim->start_sample.event_ctr;
if (nevents < DIM_NEVENTS)
break;
- dim_calc_stats(&dim->start_sample, curr_sample, &curr_stats);
+ if (!dim_calc_stats(&dim->start_sample, curr_sample, &curr_stats))
+ break;
if (rdma_dim_decision(&curr_stats, dim)) {
dim->state = DIM_APPLY_NEW_PROFILE;
schedule_work(&dim->work);