Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

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>

authored by

Gustavo A. R. Silva and committed by
Herbert Xu
61a13714 3d725965

+1 -4
+1 -4
drivers/crypto/cavium/cpt/cptvf_main.c
··· 104 104 u32 nr_queues) 105 105 { 106 106 u32 i; 107 - size_t size; 108 107 int ret; 109 108 struct pending_queue *queue = NULL; 110 109 111 110 pqinfo->nr_queues = nr_queues; 112 111 pqinfo->qlen = qlen; 113 112 114 - size = (qlen * sizeof(struct pending_entry)); 115 - 116 113 for_each_pending_queue(pqinfo, queue, i) { 117 - queue->head = kzalloc((size), GFP_KERNEL); 114 + queue->head = kcalloc(qlen, sizeof(*queue->head), GFP_KERNEL); 118 115 if (!queue->head) { 119 116 ret = -ENOMEM; 120 117 goto pending_qfail;