crypto: cavium - Use kcalloc() instead of kzalloc()
authorGustavo A. R. Silva <gustavoars@kernel.org>
Wed, 8 Dec 2021 01:24:59 +0000 (19:24 -0600)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 17 Dec 2021 05:59:47 +0000 (16:59 +1100)
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>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/cavium/cpt/cptvf_main.c

index 112b12a32542b50655a0cd76273cbf332e57c2a3..c246920e6f540c981097964ff687171b041d4fb8 100644 (file)
@@ -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;