diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2022-09-02 18:15:53 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2022-09-02 18:15:53 +0800 |
commit | fb1e1257b0cb93328f2909755b0fa2dc582cc508 (patch) | |
tree | 3f15b29f46f38b97a2c87c31fd275f1361a369ed /drivers/crypto | |
parent | a9a98d49da52c5bf63cd8bbc1f33b52edec2e9c9 (diff) |
Revert "crypto: gemini - Fix error check for dma_map_sg"
This reverts commit 545665ad1e84eb8f047018a2f607e78cef29c7fa.
The original code was correct and arguably more robust than the
patched version.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/gemini/sl3516-ce-cipher.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/crypto/gemini/sl3516-ce-cipher.c b/drivers/crypto/gemini/sl3516-ce-cipher.c index 34fea8aa91b6..14d0d83d388d 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 || nr_sgs > MAXDESC / 2) { + if (nr_sgs <= 0 || 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 || nr_sgs > MAXDESC / 2) { + if (nr_sgs <= 0 || 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 || nr_sgd > MAXDESC) { + if (nr_sgd <= 0 || nr_sgd > MAXDESC) { dev_err(ce->dev, "Invalid sg number %d\n", nr_sgd); err = -EINVAL; goto theend_sgs; |