Linux cryptographic layer development
 help / color / mirror / Atom feed
* [PATCH] crypto: caam: Clear some memory in instantiate_rng()
@ 2023-03-20 23:45 Christophe JAILLET
  2023-03-21  3:26 ` Herbert Xu
  0 siblings, 1 reply; 5+ messages in thread
From: Christophe JAILLET @ 2023-03-20 23:45 UTC (permalink / raw)
  To: horia.geanta, pankaj.gupta, gaurav.jain, herbert, davem
  Cc: linux-crypto, linux-kernel, kernel-janitors, Christophe JAILLET

According to the comment at the end of the 'for' loop just a few lines
below, it looks needed to clear 'desc'.

So it should also be cleared for the first iteration.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This patch is speculative, but can't hurt.

Maybe the memset() at the end of the 'for' loop could be removed instead.
---
 drivers/crypto/caam/ctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index 32253a064d0f..e4e971dc0f96 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -276,7 +276,7 @@ static int instantiate_rng(struct device *ctrldev, int state_handle_mask,
 	int ret = 0, sh_idx;
 
 	ctrl = (struct caam_ctrl __iomem *)ctrlpriv->ctrl;
-	desc = kmalloc(CAAM_CMD_SZ * 7, GFP_KERNEL | GFP_DMA);
+	desc = kzalloc(CAAM_CMD_SZ * 7, GFP_KERNEL | GFP_DMA);
 	if (!desc)
 		return -ENOMEM;
 
-- 
2.32.0


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

end of thread, other threads:[~2023-03-21  6:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-20 23:45 [PATCH] crypto: caam: Clear some memory in instantiate_rng() Christophe JAILLET
2023-03-21  3:26 ` Herbert Xu
2023-03-21  5:03   ` [EXT] " Gaurav Jain
2023-03-21  5:06     ` Herbert Xu
2023-03-21  6:55       ` Gaurav Jain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox