All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: netdev@vger.kernel.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH iproute2 3/3] tc/f_u32: fix const strchr() warning
Date: Sun, 23 Aug 2026 16:51:33 -0700	[thread overview]
Message-ID: <20260823235220.79790-4-stephen@networkplumber.org> (raw)
In-Reply-To: <20260823235220.79790-1-stephen@networkplumber.org>

Newer GCC propogates const char across strchr() which
requires spliting temp variable.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 tc/f_u32.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tc/f_u32.c b/tc/f_u32.c
index 088d744e..ae285146 100644
--- a/tc/f_u32.c
+++ b/tc/f_u32.c
@@ -41,13 +41,15 @@ static void explain(void)
 static int get_u32_handle(__u32 *handle, const char *str)
 {
 	__u32 htid = 0, hash = 0, nodeid = 0;
-	char *tmp = strchr(str, ':');
+	const char *colon = strchr(str, ':');
+	char *tmp;
 
-	if (tmp == NULL) {
+	if (colon == NULL) {
 		if (memcmp("0x", str, 2) == 0)
 			return get_u32(handle, str, 16);
 		return -1;
 	}
+
 	htid = strtoul(str, &tmp, 16);
 	if (tmp == str && *str != ':' && *str != 0)
 		return -1;
-- 
2.53.0


  parent reply	other threads:[~2026-08-23 23:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-23 23:51 [PATCH iproute2 0/3] compiler warning fixes Stephen Hemminger
2026-08-23 23:51 ` [PATCH iproute2 1/3] json_print: fix Gcc-17 warnings Stephen Hemminger
2026-08-23 23:51 ` [PATCH iproute2 2/3] lib: fix warning from ll_addr_a2n Stephen Hemminger
2026-08-23 23:51 ` Stephen Hemminger [this message]
2026-08-25  4:10 ` [PATCH iproute2 0/3] compiler warning fixes patchwork-bot+netdevbpf

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=20260823235220.79790-4-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=netdev@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.