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]
Date:   Fri, 2 Sep 2022 18:18:32 +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.montjoie@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Chen-Yu Tsai <wens@...e.org>,
        Jernej Skrabec <jernej.skrabec@...il.com>,
        Samuel Holland <samuel@...lland.org>,
        Dan Carpenter <dan.carpenter@...cle.com>,
        Minghao Chi <chi.minghao@....com.cn>,
        Peng Wu <wupeng58@...wei.com>,
        Alexey Khoroshilov <khoroshilov@...ras.ru>,
        linux-arm-kernel@...ts.infradead.org, linux-sunxi@...ts.linux.dev,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 5/6] crypto: allwinner: Fix dma_map_sg error check

On Thu, Aug 25, 2022 at 09:24:20AM +0200, Jack Wang wrote:
> dma_map_sg return 0 on error.
> 
> Cc: Corentin Labbe <clabbe.montjoie@...il.com>
> Cc: Herbert Xu <herbert@...dor.apana.org.au>
> Cc: "David S. Miller" <davem@...emloft.net>
> Cc: Chen-Yu Tsai <wens@...e.org>
> Cc: Jernej Skrabec <jernej.skrabec@...il.com>
> Cc: Samuel Holland <samuel@...lland.org>
> Cc: Dan Carpenter <dan.carpenter@...cle.com>
> Cc: Minghao Chi <chi.minghao@....com.cn>
> Cc: Peng Wu <wupeng58@...wei.com>
> Cc: Alexey Khoroshilov <khoroshilov@...ras.ru>
> Cc: linux-crypto@...r.kernel.org
> Cc: linux-arm-kernel@...ts.infradead.org
> Cc: linux-sunxi@...ts.linux.dev
> Cc: linux-kernel@...r.kernel.org
> Fixes: 06f751b61329 ("crypto: allwinner - Add sun8i-ce Crypto Engine")
> Fixes: d9b45418a917 ("crypto: sun8i-ss - support hash algorithms")
> Signed-off-by: Jack Wang <jinpu.wang@...os.com>
> ---
>  drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c | 6 +++---
>  drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c   | 2 +-
>  drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c | 4 ++--
>  drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c   | 2 +-
>  4 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c
> index 74b4e910a38d..be7f46faef7e 100644
> --- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c
> +++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c
> @@ -208,7 +208,7 @@ static int sun8i_ce_cipher_prepare(struct crypto_engine *engine, void *async_req
>  
>  	if (areq->src == areq->dst) {
>  		nr_sgs = dma_map_sg(ce->dev, areq->src, ns, DMA_BIDIRECTIONAL);
> -		if (nr_sgs <= 0 || nr_sgs > MAX_SG) {
> +		if (!nr_sgs || nr_sgs > MAX_SG) {

This is also less robust than the original code and I'll be
reverting it.

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