Message ID | 20200917095216.2381855-1-liushixin2@huawei.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Jason Gunthorpe |
Headers | show |
Series | [-next,v2] RDMA/mlx5: fix type warning of sizeof in __mlx5_ib_alloc_counters() | expand |
On Thu, Sep 17, 2020 at 05:52:16PM +0800, Liu Shixin wrote: > sizeof() when applied to a pointer typed expression should give the > size of the pointed data, even if the data is a pointer. > > Signed-off-by: Liu Shixin <liushixin2@huawei.com> > --- > drivers/infiniband/hw/mlx5/counters.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > Thanks, Acked-by: Leon Romanovsky <leonro@nvidia.com>
diff --git a/drivers/infiniband/hw/mlx5/counters.c b/drivers/infiniband/hw/mlx5/counters.c index 8d77fea0eb48..6f8a8b558070 100644 --- a/drivers/infiniband/hw/mlx5/counters.c +++ b/drivers/infiniband/hw/mlx5/counters.c @@ -457,7 +457,7 @@ 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;
sizeof() when applied to a pointer typed expression should give the size of the pointed data, even if the data is a pointer. Signed-off-by: Liu Shixin <liushixin2@huawei.com> --- drivers/infiniband/hw/mlx5/counters.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)