* [patch -next] crypto: talitos - fix size calculation in talitos_edesc_alloc()
@ 2015-05-11 10:10 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2015-05-11 10:10 UTC (permalink / raw)
To: Herbert Xu, LEROY Christophe
Cc: David S. Miller, linux-crypto, kernel-janitors
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>
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index c04074d..273942c 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,
alloc_len = sizeof(struct talitos_edesc);
if (assoc_nents || src_nents || dst_nents) {
if (is_sec1)
- dma_len = src_nents ? cryptlen : 0 +
- dst_nents ? cryptlen : 0;
+ dma_len = (src_nents ? cryptlen : 0) +
+ (dst_nents ? cryptlen : 0);
else
dma_len = (src_nents + dst_nents + 2 + assoc_nents) *
sizeof(struct talitos_ptr) + authsize;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [patch -next] crypto: talitos - fix size calculation in talitos_edesc_alloc()
@ 2015-05-11 10:10 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2015-05-11 10:10 UTC (permalink / raw)
To: Herbert Xu, LEROY Christophe
Cc: David S. Miller, linux-crypto, kernel-janitors
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>
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index c04074d..273942c 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,
alloc_len = sizeof(struct talitos_edesc);
if (assoc_nents || src_nents || dst_nents) {
if (is_sec1)
- dma_len = src_nents ? cryptlen : 0 +
- dst_nents ? cryptlen : 0;
+ dma_len = (src_nents ? cryptlen : 0) +
+ (dst_nents ? cryptlen : 0);
else
dma_len = (src_nents + dst_nents + 2 + assoc_nents) *
sizeof(struct talitos_ptr) + authsize;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [patch -next] crypto: talitos - fix size calculation in talitos_edesc_alloc()
2015-05-11 10:10 ` Dan Carpenter
@ 2015-05-11 13:35 ` leroy christophe
-1 siblings, 0 replies; 6+ messages in thread
From: leroy christophe @ 2015-05-11 13:35 UTC (permalink / raw)
To: Dan Carpenter, Herbert Xu; +Cc: David S. Miller, linux-crypto, kernel-janitors
Le 11/05/2015 12:10, Dan Carpenter a écrit :
> 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>
>
> diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
> index c04074d..273942c 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,
> alloc_len = sizeof(struct talitos_edesc);
> if (assoc_nents || src_nents || dst_nents) {
> if (is_sec1)
> - dma_len = src_nents ? cryptlen : 0 +
> - dst_nents ? cryptlen : 0;
> + dma_len = (src_nents ? cryptlen : 0) +
> + (dst_nents ? cryptlen : 0);
> else
> dma_len = (src_nents + dst_nents + 2 + assoc_nents) *
> sizeof(struct talitos_ptr) + authsize;
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch -next] crypto: talitos - fix size calculation in talitos_edesc_alloc()
@ 2015-05-11 13:35 ` leroy christophe
0 siblings, 0 replies; 6+ messages in thread
From: leroy christophe @ 2015-05-11 13:35 UTC (permalink / raw)
To: Dan Carpenter, Herbert Xu; +Cc: David S. Miller, linux-crypto, kernel-janitors
Le 11/05/2015 12:10, Dan Carpenter a écrit :
> 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>
>
> diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
> index c04074d..273942c 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,
> alloc_len = sizeof(struct talitos_edesc);
> if (assoc_nents || src_nents || dst_nents) {
> if (is_sec1)
> - dma_len = src_nents ? cryptlen : 0 +
> - dst_nents ? cryptlen : 0;
> + dma_len = (src_nents ? cryptlen : 0) +
> + (dst_nents ? cryptlen : 0);
> else
> dma_len = (src_nents + dst_nents + 2 + assoc_nents) *
> sizeof(struct talitos_ptr) + authsize;
>
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch -next] crypto: talitos - fix size calculation in talitos_edesc_alloc()
2015-05-11 13:35 ` leroy christophe
@ 2015-05-13 3:15 ` Herbert Xu
-1 siblings, 0 replies; 6+ messages in thread
From: Herbert Xu @ 2015-05-13 3:15 UTC (permalink / raw)
To: leroy christophe
Cc: Dan Carpenter, David S. Miller, linux-crypto, kernel-janitors
On Mon, May 11, 2015 at 03:35:12PM +0200, leroy christophe wrote:
>
>
> Le 11/05/2015 12:10, Dan Carpenter a écrit :
> >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>
Applied.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch -next] crypto: talitos - fix size calculation in talitos_edesc_alloc()
@ 2015-05-13 3:15 ` Herbert Xu
0 siblings, 0 replies; 6+ messages in thread
From: Herbert Xu @ 2015-05-13 3:15 UTC (permalink / raw)
To: leroy christophe
Cc: Dan Carpenter, David S. Miller, linux-crypto, kernel-janitors
On Mon, May 11, 2015 at 03:35:12PM +0200, leroy christophe wrote:
>
>
> Le 11/05/2015 12:10, Dan Carpenter a écrit :
> >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>
Applied.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-05-13 3:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-11 10:10 [patch -next] crypto: talitos - fix size calculation in talitos_edesc_alloc() Dan Carpenter
2015-05-11 10:10 ` Dan Carpenter
2015-05-11 13:35 ` leroy christophe
2015-05-11 13:35 ` leroy christophe
2015-05-13 3:15 ` Herbert Xu
2015-05-13 3:15 ` Herbert Xu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.