linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] RDMA/mlx5: Replace kzalloc with kcalloc
@ 2019-01-15  6:00 Gustavo A. R. Silva
  2019-01-15 10:39 ` Leon Romanovsky
  2019-01-15 22:54 ` Jason Gunthorpe
  0 siblings, 2 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2019-01-15  6:00 UTC (permalink / raw)
  To: Leon Romanovsky, Doug Ledford, Jason Gunthorpe
  Cc: linux-rdma, linux-kernel, Gustavo A. R. Silva

Replace kzalloc() function with its 2-factor argument form, kcalloc().

This patch replaces cases of:

	kzalloc(a * b, gfp)

with:
	kcalloc(a, b, gfp)

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/infiniband/hw/mlx5/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 11e9783cefcc..89dc2c6fc173 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -3823,7 +3823,7 @@ mlx5_ib_raw_fs_rule_add(struct mlx5_ib_dev *dev,
 	if (fs_matcher->priority > MLX5_IB_FLOW_LAST_PRIO)
 		return ERR_PTR(-ENOMEM);
 
-	dst = kzalloc(sizeof(*dst) * 2, GFP_KERNEL);
+	dst = kcalloc(2, sizeof(*dst), GFP_KERNEL);
 	if (!dst)
 		return ERR_PTR(-ENOMEM);
 
-- 
2.20.1


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

* Re: [PATCH] RDMA/mlx5: Replace kzalloc with kcalloc
  2019-01-15  6:00 [PATCH] RDMA/mlx5: Replace kzalloc with kcalloc Gustavo A. R. Silva
@ 2019-01-15 10:39 ` Leon Romanovsky
  2019-01-15 22:54 ` Jason Gunthorpe
  1 sibling, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2019-01-15 10:39 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Doug Ledford, Jason Gunthorpe, linux-rdma, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 511 bytes --]

On Tue, Jan 15, 2019 at 12:00:48AM -0600, Gustavo A. R. Silva wrote:
> Replace kzalloc() function with its 2-factor argument form, kcalloc().
>
> This patch replaces cases of:
>
> 	kzalloc(a * b, gfp)
>
> with:
> 	kcalloc(a, b, gfp)
>
> This code was detected with the help of Coccinelle.
>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
>  drivers/infiniband/hw/mlx5/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Thanks,
Acked-by: Leon Romanovsky <leonro@mellanox.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

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

* Re: [PATCH] RDMA/mlx5: Replace kzalloc with kcalloc
  2019-01-15  6:00 [PATCH] RDMA/mlx5: Replace kzalloc with kcalloc Gustavo A. R. Silva
  2019-01-15 10:39 ` Leon Romanovsky
@ 2019-01-15 22:54 ` Jason Gunthorpe
  2019-01-15 23:03   ` Gustavo A. R. Silva
  1 sibling, 1 reply; 4+ messages in thread
From: Jason Gunthorpe @ 2019-01-15 22:54 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Leon Romanovsky, Doug Ledford, linux-rdma, linux-kernel

On Tue, Jan 15, 2019 at 12:00:48AM -0600, Gustavo A. R. Silva wrote:
> Replace kzalloc() function with its 2-factor argument form, kcalloc().
> 
> This patch replaces cases of:
> 
> 	kzalloc(a * b, gfp)
> 
> with:
> 	kcalloc(a, b, gfp)
> 
> This code was detected with the help of Coccinelle.
> 
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> Acked-by: Leon Romanovsky <leonro@mellanox.com>
> ---
>  drivers/infiniband/hw/mlx5/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-next

Thanks,
Jason

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

* Re: [PATCH] RDMA/mlx5: Replace kzalloc with kcalloc
  2019-01-15 22:54 ` Jason Gunthorpe
@ 2019-01-15 23:03   ` Gustavo A. R. Silva
  0 siblings, 0 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2019-01-15 23:03 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Leon Romanovsky, Doug Ledford, linux-rdma, linux-kernel



On 1/15/19 4:54 PM, Jason Gunthorpe wrote:
> On Tue, Jan 15, 2019 at 12:00:48AM -0600, Gustavo A. R. Silva wrote:
>> Replace kzalloc() function with its 2-factor argument form, kcalloc().
>>
>> This patch replaces cases of:
>>
>> 	kzalloc(a * b, gfp)
>>
>> with:
>> 	kcalloc(a, b, gfp)
>>
>> This code was detected with the help of Coccinelle.
>>
>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
>> Acked-by: Leon Romanovsky <leonro@mellanox.com>
>> ---
>>  drivers/infiniband/hw/mlx5/main.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Applied to for-next
> 

Thank you both, Leon and Jason.

--
Gustavo

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

end of thread, other threads:[~2019-01-15 23:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-15  6:00 [PATCH] RDMA/mlx5: Replace kzalloc with kcalloc Gustavo A. R. Silva
2019-01-15 10:39 ` Leon Romanovsky
2019-01-15 22:54 ` Jason Gunthorpe
2019-01-15 23:03   ` Gustavo A. R. Silva

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).