All of lore.kernel.org
 help / color / mirror / Atom feed
From: leroy christophe <christophe.leroy@c-s.fr>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>,
	linux-crypto@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch -next] crypto: talitos - fix size calculation in talitos_edesc_alloc()
Date: Mon, 11 May 2015 13:35:12 +0000	[thread overview]
Message-ID: <5550B010.60008@c-s.fr> (raw)
In-Reply-To: <20150511101009.GA12395@mwanda>



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

WARNING: multiple messages have this Message-ID (diff)
From: leroy christophe <christophe.leroy@c-s.fr>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>,
	linux-crypto@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch -next] crypto: talitos - fix size calculation in talitos_edesc_alloc()
Date: Mon, 11 May 2015 15:35:12 +0200	[thread overview]
Message-ID: <5550B010.60008@c-s.fr> (raw)
In-Reply-To: <20150511101009.GA12395@mwanda>



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;
>

  reply	other threads:[~2015-05-11 13:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2015-05-11 13:35   ` leroy christophe
2015-05-13  3:15   ` Herbert Xu
2015-05-13  3:15     ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5550B010.60008@c-s.fr \
    --to=christophe.leroy@c-s.fr \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.