* [PATCH v2] crypto: keembay - Add missing check after sg_nents_for_len()
@ 2025-07-28 12:03 Thomas Fourier
2025-08-16 9:34 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Fourier @ 2025-07-28 12:03 UTC (permalink / raw)
Cc: Thomas Fourier, Daniele Alessandrelli, Declan Murphy, Herbert Xu,
David S. Miller, Mark Gross, linux-crypto, linux-kernel
sg_nents_for_len() returns an int which is negative in case of error.
Fixes: 472b04444cd3 ("crypto: keembay - Add Keem Bay OCS HCU driver")
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
---
drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c b/drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c
index 8f9e21ced0fe..48281d882260 100644
--- a/drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c
+++ b/drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c
@@ -232,7 +232,7 @@ static int kmb_ocs_dma_prepare(struct ahash_request *req)
struct device *dev = rctx->hcu_dev->dev;
unsigned int remainder = 0;
unsigned int total;
- size_t nents;
+ int nents;
size_t count;
int rc;
int i;
@@ -253,6 +253,9 @@ static int kmb_ocs_dma_prepare(struct ahash_request *req)
/* Determine the number of scatter gather list entries to process. */
nents = sg_nents_for_len(req->src, rctx->sg_data_total - remainder);
+ if (nents < 0)
+ return nents;
+
/* If there are entries to process, map them. */
if (nents) {
rctx->sg_dma_nents = dma_map_sg(dev, req->src, nents,
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] crypto: keembay - Add missing check after sg_nents_for_len()
2025-07-28 12:03 [PATCH v2] crypto: keembay - Add missing check after sg_nents_for_len() Thomas Fourier
@ 2025-08-16 9:34 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2025-08-16 9:34 UTC (permalink / raw)
To: Thomas Fourier
Cc: Daniele Alessandrelli, Declan Murphy, David S. Miller, Mark Gross,
linux-crypto, linux-kernel
On Mon, Jul 28, 2025 at 02:03:30PM +0200, Thomas Fourier wrote:
> sg_nents_for_len() returns an int which is negative in case of error.
>
> Fixes: 472b04444cd3 ("crypto: keembay - Add Keem Bay OCS HCU driver")
> Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
> ---
> drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-16 9:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-28 12:03 [PATCH v2] crypto: keembay - Add missing check after sg_nents_for_len() Thomas Fourier
2025-08-16 9:34 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).