[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220819060801.10443-8-jinpu.wang@ionos.com>
Date: Fri, 19 Aug 2022 08:07:49 +0200
From: Jack Wang <jinpu.wang@...os.com>
To: linux-kernel@...r.kernel.org
Cc: Corentin Labbe <clabbe@...libre.com>,
Hans Ulli Kroll <ulli.kroll@...glemail.com>,
Linus Walleij <linus.walleij@...aro.org>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>,
linux-crypto@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Subject: [PATCH v1 07/19] crypto: gemin: Fix error check for dma_map_sg
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
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;
@@ -158,14 +158,14 @@ static int sl3516_ce_cipher(struct skcipher_request *areq)
} else {
nr_sgs = dma_map_sg(ce->dev, areq->src, sg_nents(areq->src),
DMA_TO_DEVICE);
- 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;
}
nr_sgd = dma_map_sg(ce->dev, areq->dst, sg_nents(areq->dst),
DMA_FROM_DEVICE);
- if (nr_sgd <= 0 || nr_sgd > MAXDESC) {
+ if (!nr_sgd || nr_sgd > MAXDESC) {
dev_err(ce->dev, "Invalid sg number %d\n", nr_sgd);
err = -EINVAL;
goto theend_sgs;
--
2.34.1
Powered by blists - more mailing lists