lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YxHXZbKnfe+5pIYz@gondor.apana.org.au>
Date:   Fri, 2 Sep 2022 18:13:57 +0800
From:   Herbert Xu <herbert@...dor.apana.org.au>
To:     Jack Wang <jinpu.wang@...os.com>
Cc:     linux-crypto@...r.kernel.org, Corentin Labbe <clabbe@...libre.com>,
        Hans Ulli Kroll <ulli.kroll@...glemail.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        "David S. Miller" <davem@...emloft.net>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/6] crypto: gemin: Fix error check for dma_map_sg

On Thu, Aug 25, 2022 at 09:24:16AM +0200, Jack Wang wrote:
> dma_map_sg return 0 on error.
> 
> Cc: Corentin Labbe <clabbe@...libre.com>
> Cc: Hans Ulli Kroll <ulli.kroll@...glemail.com>
> Cc: Linus Walleij <linus.walleij@...aro.org>
> Cc: Herbert Xu <herbert@...dor.apana.org.au>
> Cc: "David S. Miller" <davem@...emloft.net>
> Cc: linux-crypto@...r.kernel.org
> Cc: linux-arm-kernel@...ts.infradead.org
> Cc: linux-kernel@...r.kernel.org
> Fixes: 46c5338db7bd ("crypto: sl3516 - Add sl3516 crypto engine")
> Signed-off-by: Jack Wang <jinpu.wang@...os.com>
> ---
>  drivers/crypto/gemini/sl3516-ce-cipher.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/crypto/gemini/sl3516-ce-cipher.c b/drivers/crypto/gemini/sl3516-ce-cipher.c
> index 14d0d83d388d..34fea8aa91b6 100644
> --- a/drivers/crypto/gemini/sl3516-ce-cipher.c
> +++ b/drivers/crypto/gemini/sl3516-ce-cipher.c
> @@ -149,7 +149,7 @@ static int sl3516_ce_cipher(struct skcipher_request *areq)
>  	if (areq->src == areq->dst) {
>  		nr_sgs = dma_map_sg(ce->dev, areq->src, sg_nents(areq->src),
>  				    DMA_BIDIRECTIONAL);
> -		if (nr_sgs <= 0 || nr_sgs > MAXDESC / 2) {
> +		if (!nr_sgs || nr_sgs > MAXDESC / 2) {
>  			dev_err(ce->dev, "Invalid sg number %d\n", nr_sgs);
>  			err = -EINVAL;
>  			goto theend;

The original code is correct and this patch is arguably making it
less robust.  So I'll drop this particular patch.

Thanks,
-- 
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ