aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2015-05-11 06:10:09 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2015-05-12 22:31:54 -0400
commit608f37d0f83e4359f48121949778bf912cd56800 (patch)
tree7af7ac9a0b13ead735b605e1efc9d689955b7fdb /drivers/crypto
parent5d1d65f8bea6de3d9c2c60fdfdd2da02da5ea672 (diff)
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>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/talitos.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index 4c0778b03de6..aaa7af856b39 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -1335,8 +1335,8 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev,
1335 alloc_len = sizeof(struct talitos_edesc); 1335 alloc_len = sizeof(struct talitos_edesc);
1336 if (assoc_nents || src_nents || dst_nents) { 1336 if (assoc_nents || src_nents || dst_nents) {
1337 if (is_sec1) 1337 if (is_sec1)
1338 dma_len = src_nents ? cryptlen : 0 + 1338 dma_len = (src_nents ? cryptlen : 0) +
1339 dst_nents ? cryptlen : 0; 1339 (dst_nents ? cryptlen : 0);
1340 else 1340 else
1341 dma_len = (src_nents + dst_nents + 2 + assoc_nents) * 1341 dma_len = (src_nents + dst_nents + 2 + assoc_nents) *
1342 sizeof(struct talitos_ptr) + authsize; 1342 sizeof(struct talitos_ptr) + authsize;