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

Configure Feed

Select the types of activity you want to include in your feed.

crypto: omap - Allocate OMAP_CRYPTO_FORCE_COPY scatterlists correctly

The existing allocation of scatterlists in omap_crypto_copy_sg_lists()
was allocating an array of scatterlist pointers, not scatterlist objects,
resulting in a 4x too small allocation.

Use sizeof(*new_sg) to get the correct object size.

Fixes: 74ed87e7e7f7 ("crypto: omap - add base support library for common routines")
Signed-off-by: Kees Cook <kees@kernel.org>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Kees Cook and committed by
Linus Torvalds
1562b1fb 08df88fa

+1 -1
+1 -1
drivers/crypto/omap-crypto.c
··· 21 21 struct scatterlist *tmp; 22 22 23 23 if (!(flags & OMAP_CRYPTO_FORCE_SINGLE_ENTRY)) { 24 - new_sg = kmalloc_array(n, sizeof(*sg), GFP_KERNEL); 24 + new_sg = kmalloc_array(n, sizeof(*new_sg), GFP_KERNEL); 25 25 if (!new_sg) 26 26 return -ENOMEM; 27 27