[PATCH 5/6] crypto: allwinner: Fix dma_map_sg error check
Herbert Xu
herbert at gondor.apana.org.au
Fri Sep 2 03:18:32 PDT 2022
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 at gmail.com>
> Cc: Herbert Xu <herbert at gondor.apana.org.au>
> Cc: "David S. Miller" <davem at davemloft.net>
> Cc: Chen-Yu Tsai <wens at csie.org>
> Cc: Jernej Skrabec <jernej.skrabec at gmail.com>
> Cc: Samuel Holland <samuel at sholland.org>
> Cc: Dan Carpenter <dan.carpenter at oracle.com>
> Cc: Minghao Chi <chi.minghao at zte.com.cn>
> Cc: Peng Wu <wupeng58 at huawei.com>
> Cc: Alexey Khoroshilov <khoroshilov at ispras.ru>
> Cc: linux-crypto at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-sunxi at lists.linux.dev
> Cc: linux-kernel at 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 <jinpu.wang at ionos.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 at gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
More information about the linux-arm-kernel
mailing list