DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: stable@dpdk.org, Gagandeep Singh <g.singh@nxp.com>,
	Hemant Agrawal <hemant.agrawal@nxp.com>,
	Akhil Goyal <gakhil@marvell.com>
Subject: [PATCH 4/7] crypto/caam_jr: fix const pointer in UIO filename parsing
Date: Fri, 28 Nov 2025 14:56:12 +0100	[thread overview]
Message-ID: <20251128135616.2662164-5-david.marchand@redhat.com> (raw)
In-Reply-To: <20251128135616.2662164-1-david.marchand@redhat.com>

With latest glibc (Fedora Rawhide):
../drivers/crypto/caam_jr/caam_jr_uio.c: In function
	'file_name_match_extract':
../drivers/crypto/caam_jr/caam_jr_uio.c:111:16: warning: assignment
	discards 'const' qualifier from pointer target type
	[-Wdiscarded-qualifiers]
  111 |         substr = strstr(filename, match);
      |                ^

Fixes: e7a45f3cc245 ("crypto/caam_jr: add UIO specific operations")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/crypto/caam_jr/caam_jr_uio.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/crypto/caam_jr/caam_jr_uio.c b/drivers/crypto/caam_jr/caam_jr_uio.c
index 8956f7750d..43357091e1 100644
--- a/drivers/crypto/caam_jr/caam_jr_uio.c
+++ b/drivers/crypto/caam_jr/caam_jr_uio.c
@@ -106,19 +106,11 @@ static int g_uio_jr_num;
 static bool
 file_name_match_extract(const char filename[], const char match[], int *number)
 {
-	char *substr = NULL;
-
-	substr = strstr(filename, match);
-	if (substr == NULL)
-		return false;
-
 	/* substring <match> was found in <filename>
 	 * read number following <match> substring in <filename>
 	 */
-	if (sscanf(filename + strlen(match), "%d", number) <= 0)
-		return false;
-
-	return true;
+	return strstr(filename, match) != NULL &&
+		sscanf(filename + strlen(match), "%d", number) > 0;
 }
 
 /** @brief Reads first line from a file.
-- 
2.51.1


  parent reply	other threads:[~2025-11-28 13:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-28 13:56 [PATCH 0/7] Fixes for Fedora Rawhide David Marchand
2025-11-28 13:56 ` [PATCH 1/7] bus/ifpga: fix const pointer in device name parsing David Marchand
2025-11-28 13:56 ` [PATCH 2/7] bus/uacce: fix const pointer in device matching David Marchand
2025-11-28 13:56 ` [PATCH 3/7] drivers: fix some const pointers in qat drivers David Marchand
2025-11-28 13:56 ` David Marchand [this message]
2025-11-28 14:00   ` [PATCH 4/7] crypto/caam_jr: fix const pointer in UIO filename parsing Hemant Agrawal
2025-11-28 13:56 ` [PATCH 5/7] net/enetfec: " David Marchand
2025-11-28 14:00   ` Hemant Agrawal
2025-11-28 13:56 ` [PATCH 6/7] net/memif: fix const pointer in socket check David Marchand
2025-11-28 13:56 ` [PATCH 7/7] app/procinfo: fix const pointer in collectd format David Marchand

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=20251128135616.2662164-5-david.marchand@redhat.com \
    --to=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=g.singh@nxp.com \
    --cc=gakhil@marvell.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=stable@dpdk.org \
    /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;
as well as URLs for NNTP newsgroup(s).