* [PATCH][next] net: mana: Use kcalloc() instead of kzalloc()
@ 2021-10-06 18:09 Gustavo A. R. Silva
2021-10-06 18:24 ` Dexuan Cui
0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2021-10-06 18:09 UTC (permalink / raw)
To: K. Y. Srinivasan, Haiyang Zhang, Stephen Hemminger, Wei Liu,
Dexuan Cui, David S. Miller, Jakub Kicinski
Cc: linux-hyperv, netdev, linux-kernel, Gustavo A. R. Silva, linux-hardening
Use 2-factor multiplication argument form kcalloc() instead
of kzalloc().
Link: https://github.com/KSPP/linux/issues/162
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
drivers/net/ethernet/microsoft/mana/hw_channel.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/microsoft/mana/hw_channel.c b/drivers/net/ethernet/microsoft/mana/hw_channel.c
index d5c485a6d284..7c7a5fb91f79 100644
--- a/drivers/net/ethernet/microsoft/mana/hw_channel.c
+++ b/drivers/net/ethernet/microsoft/mana/hw_channel.c
@@ -363,7 +363,7 @@ static int mana_hwc_create_cq(struct hw_channel_context *hwc, u16 q_depth,
}
hwc_cq->gdma_cq = cq;
- comp_buf = kcalloc(q_depth, sizeof(struct gdma_comp), GFP_KERNEL);
+ comp_buf = kcalloc(q_depth, sizeof(*comp_buf), GFP_KERNEL);
if (!comp_buf) {
err = -ENOMEM;
goto out;
@@ -580,7 +580,7 @@ static int mana_hwc_test_channel(struct hw_channel_context *hwc, u16 q_depth,
return err;
}
- ctx = kzalloc(q_depth * sizeof(struct hwc_caller_ctx), GFP_KERNEL);
+ ctx = kcalloc(q_depth, sizeof(*ctx), GFP_KERNEL);
if (!ctx)
return -ENOMEM;
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH][next] net: mana: Use kcalloc() instead of kzalloc()
2021-10-06 18:09 [PATCH][next] net: mana: Use kcalloc() instead of kzalloc() Gustavo A. R. Silva
@ 2021-10-06 18:24 ` Dexuan Cui
0 siblings, 0 replies; 2+ messages in thread
From: Dexuan Cui @ 2021-10-06 18:24 UTC (permalink / raw)
To: Gustavo A. R. Silva, KY Srinivasan, Haiyang Zhang,
Stephen Hemminger, Wei Liu, David S. Miller, Jakub Kicinski
Cc: linux-hyperv, netdev, linux-kernel, linux-hardening
> From: Gustavo A. R. Silva <gustavoars@kernel.org>
> Sent: Wednesday, October 6, 2021 11:09 AM
> ...
> Subject: [PATCH][next] net: mana: Use kcalloc() instead of kzalloc()
The [next] should be [net-next], butI guess David can fix this for you :-)
Reviewed-by: Dexuan Cui <decui@microsoft.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-06 18:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-06 18:09 [PATCH][next] net: mana: Use kcalloc() instead of kzalloc() Gustavo A. R. Silva
2021-10-06 18:24 ` Dexuan Cui
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).