Skip to content

Commit 1562b1f

Browse files
keestorvalds
authored andcommitted
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: 74ed87e ("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>
1 parent 08df88f commit 1562b1f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/crypto/omap-crypto.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ static int omap_crypto_copy_sg_lists(int total, int bs,
2121
struct scatterlist *tmp;
2222

2323
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);
2525
if (!new_sg)
2626
return -ENOMEM;
2727

0 commit comments

Comments
 (0)