mirror of
https://github.com/torvalds/linux.git
synced 2026-11-23 23:11:40 +00:00
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: 74ed87e7e7 ("crypto: omap - add base support library for common routines")
Signed-off-by: Kees Cook <[email protected]>
Acked-by: Herbert Xu <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
committed by
Linus Torvalds
parent
08df88fa14
commit
1562b1fb7e
@@ -21,7 +21,7 @@ static int omap_crypto_copy_sg_lists(int total, int bs,
|
||||
struct scatterlist *tmp;
|
||||
|
||||
if (!(flags & OMAP_CRYPTO_FORCE_SINGLE_ENTRY)) {
|
||||
new_sg = kmalloc_array(n, sizeof(*sg), GFP_KERNEL);
|
||||
new_sg = kmalloc_array(n, sizeof(*new_sg), GFP_KERNEL);
|
||||
if (!new_sg)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user