Skip to contentSkip to conversation

crypto: cavium - Use kcalloc() instead of kzalloc()

PATCH In review Gustavo A. R. Silva 3 participants 3 messages Dec 8, 2021 – Dec 17, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: cavium - Use kcalloc() instead of kzalloc()

Use 2-factor multiplication argument form kcalloc() instead of kzalloc().

---
 drivers/crypto/cavium/cpt/cptvf_main.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/crypto/cavium/cpt/cptvf_main.c +1 -4
index 112b12a32542..c246920e6f54 100644
@@ -104,17 +104,14 @@ static int alloc_pending_queues(struct pending_qinfo *pqinfo, u32 qlen,
 				u32 nr_queues)
 {
 	u32 i;
-	size_t size;
 	int ret;
 	struct pending_queue *queue = NULL;
 
 	pqinfo->nr_queues = nr_queues;
 	pqinfo->qlen = qlen;
 
-	size = (qlen * sizeof(struct pending_entry));
-
 	for_each_pending_queue(pqinfo, queue, i) {
-		queue->head = kzalloc((size), GFP_KERNEL);
+		queue->head = kcalloc(qlen, sizeof(*queue->head), GFP_KERNEL);
 		if (!queue->head) {
 			ret = -ENOMEM;
 			goto pending_qfail;
Signature · 1 line
2.27.0
maintainer
#2 lore raw
In reply to Gustavo A. R. Silva
Quoted 8 lines · Gustavo A. R. Silva

Use 2-factor multiplication argument form kcalloc() instead of kzalloc().

---
 drivers/crypto/cavium/cpt/cptvf_main.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt