Skip to content

Commit 5124bc9

Browse files
committed
crypto: caam - Pad SG length when allocating hash edesc
Because hardware will read in multiples of 4 SG entries, ensure the allocated length is always padded. This was already done by some callers of ahash_edesc_alloc, but ahash_digest was conspicuously missing. In any case, doing it in the allocation function ensures that the memory is always there. Reported-by: Guangwu Zhang <[email protected]> Fixes: a5e5c13 ("crypto: caam - fix S/G table passing page boundary") Signed-off-by: Herbert Xu <[email protected]>
1 parent ce212d2 commit 5124bc9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/crypto/caam/caamhash.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,7 @@ static struct ahash_edesc *ahash_edesc_alloc(struct ahash_request *req,
708708
GFP_KERNEL : GFP_ATOMIC;
709709
struct ahash_edesc *edesc;
710710

711+
sg_num = pad_sg_nents(sg_num);
711712
edesc = kzalloc(struct_size(edesc, sec4_sg, sg_num), flags);
712713
if (!edesc)
713714
return NULL;

0 commit comments

Comments
 (0)