mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-10 15:19:51 +00:00
crypto: talitos - fix size calculation in talitos_edesc_alloc()
The + operation has higher precedence than ?: so we need parentheses here. Otherwise we may end up allocating a max of only one "cryptlen" instead of two. Fixes: 6f65f6ac5fb3 ('crypto: talitos - implement scatter/gather copy for SEC1') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
5d1d65f8be
commit
608f37d0f8
@ -1335,8 +1335,8 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev,
|
|||||||
alloc_len = sizeof(struct talitos_edesc);
|
alloc_len = sizeof(struct talitos_edesc);
|
||||||
if (assoc_nents || src_nents || dst_nents) {
|
if (assoc_nents || src_nents || dst_nents) {
|
||||||
if (is_sec1)
|
if (is_sec1)
|
||||||
dma_len = src_nents ? cryptlen : 0 +
|
dma_len = (src_nents ? cryptlen : 0) +
|
||||||
dst_nents ? cryptlen : 0;
|
(dst_nents ? cryptlen : 0);
|
||||||
else
|
else
|
||||||
dma_len = (src_nents + dst_nents + 2 + assoc_nents) *
|
dma_len = (src_nents + dst_nents + 2 + assoc_nents) *
|
||||||
sizeof(struct talitos_ptr) + authsize;
|
sizeof(struct talitos_ptr) + authsize;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user