netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] use kzalloc
@ 2022-03-12 10:26 Julia Lawall
  2022-03-12 10:27 ` [PATCH 2/6] net/mlx4_en: " Julia Lawall
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Julia Lawall @ 2022-03-12 10:26 UTC (permalink / raw)
  To: linux-wireless
  Cc: kernel-janitors, alsa-devel, samba-technical, linux-cifs,
	linux-kernel, netdev, linux-rdma, linux-scsi, Andrey Konovalov,
	linux-usb

Use kzalloc instead of kmalloc + memset.

---

 drivers/net/ethernet/mellanox/mlx4/en_rx.c |    3 +--
 drivers/net/wireless/zydas/zd1201.c        |    3 +--
 drivers/scsi/lpfc/lpfc_debugfs.c           |    9 ++-------
 drivers/usb/gadget/legacy/raw_gadget.c     |    3 +--
 fs/cifs/transport.c                        |    3 +--
 sound/core/seq/oss/seq_oss_init.c          |    3 +--
 6 files changed, 7 insertions(+), 17 deletions(-)

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

* [PATCH 2/6] net/mlx4_en: use kzalloc
  2022-03-12 10:26 [PATCH 0/6] use kzalloc Julia Lawall
@ 2022-03-12 10:27 ` Julia Lawall
  2022-03-14 12:37   ` Tariq Toukan
  2022-03-12 10:27 ` [PATCH 5/6] zd1201: " Julia Lawall
  2022-03-14 20:30 ` [PATCH 0/6] " patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Julia Lawall @ 2022-03-12 10:27 UTC (permalink / raw)
  To: Tariq Toukan
  Cc: kernel-janitors, David S. Miller, Jakub Kicinski, netdev,
	linux-rdma, linux-kernel

Use kzalloc instead of kmalloc + memset.

The semantic patch that makes this change is:
(https://coccinelle.gitlabpages.inria.fr/website/)

//<smpl>
@@
expression res, size, flag;
@@
- res = kmalloc(size, flag);
+ res = kzalloc(size, flag);
  ...
- memset(res, 0, size);
//</smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

---
 drivers/net/ethernet/mellanox/mlx4/en_rx.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index 8cfc649f226b..8f762fc170b3 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -1067,7 +1067,7 @@ static int mlx4_en_config_rss_qp(struct mlx4_en_priv *priv, int qpn,
 	struct mlx4_qp_context *context;
 	int err = 0;
 
-	context = kmalloc(sizeof(*context), GFP_KERNEL);
+	context = kzalloc(sizeof(*context), GFP_KERNEL);
 	if (!context)
 		return -ENOMEM;
 
@@ -1078,7 +1078,6 @@ static int mlx4_en_config_rss_qp(struct mlx4_en_priv *priv, int qpn,
 	}
 	qp->event = mlx4_en_sqp_event;
 
-	memset(context, 0, sizeof(*context));
 	mlx4_en_fill_qp_context(priv, ring->actual_size, ring->stride, 0, 0,
 				qpn, ring->cqn, -1, context);
 	context->db_rec_addr = cpu_to_be64(ring->wqres.db.dma);


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

* [PATCH 5/6] zd1201: use kzalloc
  2022-03-12 10:26 [PATCH 0/6] use kzalloc Julia Lawall
  2022-03-12 10:27 ` [PATCH 2/6] net/mlx4_en: " Julia Lawall
@ 2022-03-12 10:27 ` Julia Lawall
  2022-03-16 15:29   ` Kalle Valo
  2022-03-14 20:30 ` [PATCH 0/6] " patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Julia Lawall @ 2022-03-12 10:27 UTC (permalink / raw)
  To: Kalle Valo
  Cc: kernel-janitors, David S. Miller, Jakub Kicinski, linux-wireless,
	netdev, linux-kernel

Use kzalloc instead of kmalloc + memset.

The semantic patch that makes this change is:
(https://coccinelle.gitlabpages.inria.fr/website/)

//<smpl>
@@
expression res, size, flag;
@@
- res = kmalloc(size, flag);
+ res = kzalloc(size, flag);
  ...
- memset(res, 0, size);
//</smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

---
 drivers/net/wireless/zydas/zd1201.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/zydas/zd1201.c b/drivers/net/wireless/zydas/zd1201.c
index e64e4e579518..82bc0d44212e 100644
--- a/drivers/net/wireless/zydas/zd1201.c
+++ b/drivers/net/wireless/zydas/zd1201.c
@@ -521,7 +521,7 @@ static int zd1201_setconfig(struct zd1201 *zd, int rid, const void *buf, int len
 	zd->rxdatas = 0;
 	zd->rxlen = 0;
 	for (seq=0; len > 0; seq++) {
-		request = kmalloc(16, gfp_mask);
+		request = kzalloc(16, gfp_mask);
 		if (!request)
 			return -ENOMEM;
 		urb = usb_alloc_urb(0, gfp_mask);
@@ -529,7 +529,6 @@ static int zd1201_setconfig(struct zd1201 *zd, int rid, const void *buf, int len
 			kfree(request);
 			return -ENOMEM;
 		}
-		memset(request, 0, 16);
 		reqlen = len>12 ? 12 : len;
 		request[0] = ZD1201_USB_RESREQ;
 		request[1] = seq;


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

* Re: [PATCH 2/6] net/mlx4_en: use kzalloc
  2022-03-12 10:27 ` [PATCH 2/6] net/mlx4_en: " Julia Lawall
@ 2022-03-14 12:37   ` Tariq Toukan
  0 siblings, 0 replies; 6+ messages in thread
From: Tariq Toukan @ 2022-03-14 12:37 UTC (permalink / raw)
  To: Julia Lawall, Tariq Toukan
  Cc: kernel-janitors, David S. Miller, Jakub Kicinski, netdev,
	linux-rdma, linux-kernel



On 3/12/2022 12:27 PM, Julia Lawall wrote:
> Use kzalloc instead of kmalloc + memset.
> 
> The semantic patch that makes this change is:
> (https://coccinelle.gitlabpages.inria.fr/website/)
> 
> //<smpl>
> @@
> expression res, size, flag;
> @@
> - res = kmalloc(size, flag);
> + res = kzalloc(size, flag);
>    ...
> - memset(res, 0, size);
> //</smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
> 
> ---
>   drivers/net/ethernet/mellanox/mlx4/en_rx.c |    3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> index 8cfc649f226b..8f762fc170b3 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> @@ -1067,7 +1067,7 @@ static int mlx4_en_config_rss_qp(struct mlx4_en_priv *priv, int qpn,
>   	struct mlx4_qp_context *context;
>   	int err = 0;
>   
> -	context = kmalloc(sizeof(*context), GFP_KERNEL);
> +	context = kzalloc(sizeof(*context), GFP_KERNEL);
>   	if (!context)
>   		return -ENOMEM;
>   
> @@ -1078,7 +1078,6 @@ static int mlx4_en_config_rss_qp(struct mlx4_en_priv *priv, int qpn,
>   	}
>   	qp->event = mlx4_en_sqp_event;
>   
> -	memset(context, 0, sizeof(*context));
>   	mlx4_en_fill_qp_context(priv, ring->actual_size, ring->stride, 0, 0,
>   				qpn, ring->cqn, -1, context);
>   	context->db_rec_addr = cpu_to_be64(ring->wqres.db.dma);
> 

Thanks for your patch.

Reviewed-by: Tariq Toukan <tariqt@nvidia.com>


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

* Re: [PATCH 0/6] use kzalloc
  2022-03-12 10:26 [PATCH 0/6] use kzalloc Julia Lawall
  2022-03-12 10:27 ` [PATCH 2/6] net/mlx4_en: " Julia Lawall
  2022-03-12 10:27 ` [PATCH 5/6] zd1201: " Julia Lawall
@ 2022-03-14 20:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-14 20:30 UTC (permalink / raw)
  To: Julia Lawall
  Cc: linux-wireless, kernel-janitors, alsa-devel, samba-technical,
	linux-cifs, linux-kernel, netdev, linux-rdma, linux-scsi,
	andreyknvl, linux-usb

Hello:

This series was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Sat, 12 Mar 2022 11:26:59 +0100 you wrote:
> Use kzalloc instead of kmalloc + memset.
> 
> ---
> 
>  drivers/net/ethernet/mellanox/mlx4/en_rx.c |    3 +--
>  drivers/net/wireless/zydas/zd1201.c        |    3 +--
>  drivers/scsi/lpfc/lpfc_debugfs.c           |    9 ++-------
>  drivers/usb/gadget/legacy/raw_gadget.c     |    3 +--
>  fs/cifs/transport.c                        |    3 +--
>  sound/core/seq/oss/seq_oss_init.c          |    3 +--
>  6 files changed, 7 insertions(+), 17 deletions(-)

Here is the summary with links:
  - [2/6] net/mlx4_en: use kzalloc
    https://git.kernel.org/netdev/net-next/c/3c2dfb735b4a
  - [5/6] zd1201: use kzalloc
    (no matching commit)

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH 5/6] zd1201: use kzalloc
  2022-03-12 10:27 ` [PATCH 5/6] zd1201: " Julia Lawall
@ 2022-03-16 15:29   ` Kalle Valo
  0 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2022-03-16 15:29 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, David S. Miller, Jakub Kicinski, linux-wireless,
	netdev, linux-kernel

Julia Lawall <Julia.Lawall@inria.fr> wrote:

> Use kzalloc instead of kmalloc + memset.
> 
> The semantic patch that makes this change is:
> (https://coccinelle.gitlabpages.inria.fr/website/)
> 
> //<smpl>
> @@
> expression res, size, flag;
> @@
> - res = kmalloc(size, flag);
> + res = kzalloc(size, flag);
>   ...
> - memset(res, 0, size);
> //</smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

Patch applied to wireless-next.git, thanks.

3c0e3ca6028b zd1201: use kzalloc

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20220312102705.71413-6-Julia.Lawall@inria.fr/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


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

end of thread, other threads:[~2022-03-16 15:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-12 10:26 [PATCH 0/6] use kzalloc Julia Lawall
2022-03-12 10:27 ` [PATCH 2/6] net/mlx4_en: " Julia Lawall
2022-03-14 12:37   ` Tariq Toukan
2022-03-12 10:27 ` [PATCH 5/6] zd1201: " Julia Lawall
2022-03-16 15:29   ` Kalle Valo
2022-03-14 20:30 ` [PATCH 0/6] " patchwork-bot+netdevbpf

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