linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] RDMA/mlx5: fix type warning of sizeof in __mlx5_ib_alloc_counters()
@ 2020-09-17  8:13 Liu Shixin
  2020-09-17  8:29 ` Leon Romanovsky
  2020-09-25 12:41 ` Jason Gunthorpe
  0 siblings, 2 replies; 13+ messages in thread
From: Liu Shixin @ 2020-09-17  8:13 UTC (permalink / raw)
  To: Leon Romanovsky, Doug Ledford, Jason Gunthorpe
  Cc: linux-rdma, linux-kernel, Liu Shixin

sizeof() when applied to a pointer typed expression should gives 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 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/counters.c b/drivers/infiniband/hw/mlx5/counters.c
index 145f3cb40ccb..aeeb14ecb3ee 100644
--- a/drivers/infiniband/hw/mlx5/counters.c
+++ b/drivers/infiniband/hw/mlx5/counters.c
@@ -456,12 +456,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;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-09-25 12:41 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-17  8:13 [PATCH -next] RDMA/mlx5: fix type warning of sizeof in __mlx5_ib_alloc_counters() Liu Shixin
2020-09-17  8:29 ` Leon Romanovsky
2020-09-17  9:10   ` Liu Shixin
2020-09-17  9:08     ` Leon Romanovsky
2020-09-17  9:52       ` [PATCH -next v2] " Liu Shixin
2020-09-17 10:09         ` Leon Romanovsky
2020-09-17 12:38       ` [PATCH -next] " Jason Gunthorpe
2020-09-17 17:05         ` Leon Romanovsky
2020-09-17 17:24           ` Jason Gunthorpe
2020-09-17 17:33             ` Leon Romanovsky
2020-09-18  3:23               ` Liu Shixin
2020-09-21 13:26                 ` Leon Romanovsky
2020-09-25 12:41 ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).