Skip to content

Commit

Permalink
RDMA/mlx5: Fix type warning of sizeof in __mlx5_ib_alloc_counters()
Browse files Browse the repository at this point in the history
sizeof() when applied to a pointer typed expression should give the size
of the pointed data, even if the data is a pointer.

Fixes: e1f24a7 ("IB/mlx5: Support congestion related counters")
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Liu Shixin <[email protected]>
Acked-by: Leon Romanovsky <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
  • Loading branch information
Liu Shixin authored and jgunthorpe committed Sep 25, 2020
1 parent 30b7078 commit b942fc0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/infiniband/hw/mlx5/counters.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,12 +457,12 @@ static int __mlx5_ib_alloc_counters(struct mlx5_ib_dev *dev,
cnts->num_ext_ppcnt_counters = ARRAY_SIZE(ext_ppcnt_cnts);
num_counters += ARRAY_SIZE(ext_ppcnt_cnts);
}
cnts->names = kcalloc(num_counters, sizeof(cnts->names), GFP_KERNEL);
cnts->names = kcalloc(num_counters, sizeof(*cnts->names), GFP_KERNEL);
if (!cnts->names)
return -ENOMEM;

cnts->offsets = kcalloc(num_counters,
sizeof(cnts->offsets), GFP_KERNEL);
sizeof(*cnts->offsets), GFP_KERNEL);
if (!cnts->offsets)
goto err_names;

Expand Down

0 comments on commit b942fc0

Please sign in to comment.