diff mbox series

[2/2] crypto: hisilicon/qm - replace devm_kzalloc with devm_kcalloc

Message ID 20250503-hisilicon_qm-v1-2-d4ebc242bc8a@ethancedwards.com
State New
Headers show
Series crypto: hisilicon/qm - memory allocation cleanups | expand

Commit Message

Ethan Carter Edwards May 3, 2025, 8:21 p.m. UTC
Replace devm_kzalloc that has an internal multiplication with
devm_kcalloc to improve code readability and safety from overflows.

Signed-off-by: Ethan Carter Edwards <ethan@ethancedwards.com>
---
 drivers/crypto/hisilicon/qm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index 80d57f0dbf26e2902e01103b0a705234009161ee..7c41f9593d039157ad900ee9fcc00e137d2ec169 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -5224,7 +5224,7 @@  static int qm_pre_store_caps(struct hisi_qm *qm)
 	size_t i, size;
 
 	size = ARRAY_SIZE(qm_cap_query_info);
-	qm_cap = devm_kzalloc(&pdev->dev, sizeof(*qm_cap) * size, GFP_KERNEL);
+	qm_cap = devm_kcalloc(&pdev->dev, sizeof(*qm_cap), size, GFP_KERNEL);
 	if (!qm_cap)
 		return -ENOMEM;