From: "Murphy, Declan" <declan.murphy@intel.com>
To: Thomas Fourier <fourier.thomas@gmail.com>
Cc: "Alessandrelli, Daniele" <daniele.alessandrelli@intel.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
"Mark Gross" <mgross@linux.intel.com>,
"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] crypto: keembay - Add missing check after sg_nents_for_len()
Date: Wed, 16 Jul 2025 12:25:12 +0000 [thread overview]
Message-ID: <BY1PR11MB7983BC06882ABC5D8B471F2FEB56A@BY1PR11MB7983.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20250716122023.67129-2-fourier.thomas@gmail.com>
Looks Good To Me.
Thank you for the fix,
Declan
-----Original Message-----
From: Thomas Fourier <fourier.thomas@gmail.com>
Sent: Wednesday, July 16, 2025 1:20 PM
Cc: Thomas Fourier <fourier.thomas@gmail.com>; Alessandrelli, Daniele <daniele.alessandrelli@intel.com>; Murphy, Declan <declan.murphy@intel.com>; Herbert Xu <herbert@gondor.apana.org.au>; David S. Miller <davem@davemloft.net>; Mark Gross <mgross@linux.intel.com>; linux-crypto@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: [PATCH] crypto: keembay - Add missing check after sg_nents_for_len()
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..c75fd7c68fd7 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
--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263
This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.
next prev parent reply other threads:[~2025-07-16 12:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-16 12:20 Thomas Fourier
2025-07-16 12:25 ` Murphy, Declan [this message]
2025-07-27 12:37 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BY1PR11MB7983BC06882ABC5D8B471F2FEB56A@BY1PR11MB7983.namprd11.prod.outlook.com \
--to=declan.murphy@intel.com \
--cc=daniele.alessandrelli@intel.com \
--cc=davem@davemloft.net \
--cc=fourier.thomas@gmail.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mgross@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®