2022-08-19 06:09:36

by Jinpu Wang

[permalink] [raw]
Subject: [PATCH v1 07/19] crypto: gemin: Fix error check for dma_map_sg

dma_map_sg return 0 on error.

Cc: Corentin Labbe <[email protected]>
Cc: Hans Ulli Kroll <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Herbert Xu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Jack Wang <[email protected]>
---
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


2022-08-26 08:26:57

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH v1 07/19] crypto: gemin: Fix error check for dma_map_sg

On Fri, Aug 19, 2022 at 8:08 AM Jack Wang <[email protected]> wrote:

> dma_map_sg return 0 on error.
>
> Cc: Corentin Labbe <[email protected]>
> Cc: Hans Ulli Kroll <[email protected]>
> Cc: Linus Walleij <[email protected]>
> Cc: Herbert Xu <[email protected]>
> Cc: "David S. Miller" <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Jack Wang <[email protected]>

Good catch!
Reviewed-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij

2022-08-26 11:09:04

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH v1 07/19] crypto: gemin: Fix error check for dma_map_sg

On Fri, Aug 19, 2022 at 08:07:49AM +0200, Jack Wang wrote:
> dma_map_sg return 0 on error.
>
> Cc: Corentin Labbe <[email protected]>
> Cc: Hans Ulli Kroll <[email protected]>
> Cc: Linus Walleij <[email protected]>
> Cc: Herbert Xu <[email protected]>
> Cc: "David S. Miller" <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Jack Wang <[email protected]>
> ---
> drivers/crypto/gemini/sl3516-ce-cipher.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)

Patches 7-12 applied. Thanks.
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

2022-08-26 12:11:10

by Corentin LABBE

[permalink] [raw]
Subject: Re: [PATCH v1 07/19] crypto: gemin: Fix error check for dma_map_sg

Le Fri, Aug 19, 2022 at 08:07:49AM +0200, Jack Wang a ?crit :
> dma_map_sg return 0 on error.
>
> Cc: Corentin Labbe <[email protected]>
> Cc: Hans Ulli Kroll <[email protected]>
> Cc: Linus Walleij <[email protected]>
> Cc: Herbert Xu <[email protected]>
> Cc: "David S. Miller" <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Jack Wang <[email protected]>
> ---
> drivers/crypto/gemini/sl3516-ce-cipher.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>

Hello

There is a typo in subject gemin -> gemini.

Acked-by: Corentin Labbe <[email protected]>
Tested-by: Corentin Labbe <[email protected]>

Thanks
Regards

2022-08-26 12:12:31

by Jinpu Wang

[permalink] [raw]
Subject: Re: [PATCH v1 07/19] crypto: gemin: Fix error check for dma_map_sg

On Fri, Aug 26, 2022 at 2:04 PM LABBE Corentin <[email protected]> wrote:
>
> Le Fri, Aug 19, 2022 at 08:07:49AM +0200, Jack Wang a écrit :
> > dma_map_sg return 0 on error.
> >
> > Cc: Corentin Labbe <[email protected]>
> > Cc: Hans Ulli Kroll <[email protected]>
> > Cc: Linus Walleij <[email protected]>
> > Cc: Herbert Xu <[email protected]>
> > Cc: "David S. Miller" <[email protected]>
> > Cc: [email protected]
> > Cc: [email protected]
> > Cc: [email protected]
> > Signed-off-by: Jack Wang <[email protected]>
> > ---
> > drivers/crypto/gemini/sl3516-ce-cipher.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
>
> Hello
>
> There is a typo in subject gemin -> gemini.
indeed, maybe Herbert can fix the subject in his tree.
>
> Acked-by: Corentin Labbe <[email protected]>
> Tested-by: Corentin Labbe <[email protected]>
>
> Thanks
> Regards
Thx!