From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fornost.hmeau.com (helcar.hmeau.com [216.24.177.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7B8B111E for ; Fri, 2 Sep 2022 10:55:55 +0000 (UTC) Received: from gwarestrin.arnor.me.apana.org.au ([192.168.103.7]) by fornost.hmeau.com with smtp (Exim 4.94.2 #2 (Debian)) id 1oU3ku-000Kds-Rx; Fri, 02 Sep 2022 20:18:33 +1000 Received: by gwarestrin.arnor.me.apana.org.au (sSMTP sendmail emulation); Fri, 02 Sep 2022 18:18:32 +0800 Date: Fri, 2 Sep 2022 18:18:32 +0800 From: Herbert Xu To: Jack Wang Cc: linux-crypto@vger.kernel.org, Corentin Labbe , "David S. Miller" , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dan Carpenter , Minghao Chi , Peng Wu , Alexey Khoroshilov , linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 5/6] crypto: allwinner: Fix dma_map_sg error check Message-ID: References: <20220825072421.29020-1-jinpu.wang@ionos.com> <20220825072421.29020-6-jinpu.wang@ionos.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220825072421.29020-6-jinpu.wang@ionos.com> On Thu, Aug 25, 2022 at 09:24:20AM +0200, Jack Wang wrote: > dma_map_sg return 0 on error. > > Cc: Corentin Labbe > Cc: Herbert Xu > Cc: "David S. Miller" > Cc: Chen-Yu Tsai > Cc: Jernej Skrabec > Cc: Samuel Holland > Cc: Dan Carpenter > Cc: Minghao Chi > Cc: Peng Wu > Cc: Alexey Khoroshilov > Cc: linux-crypto@vger.kernel.org > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-sunxi@lists.linux.dev > Cc: linux-kernel@vger.kernel.org > Fixes: 06f751b61329 ("crypto: allwinner - Add sun8i-ce Crypto Engine") > Fixes: d9b45418a917 ("crypto: sun8i-ss - support hash algorithms") > Signed-off-by: Jack Wang > --- > 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 Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt