[PATCH net-next] selftests: net: tcp_ao: make the netstat column pointer const

From: Sasha Levin

Date: Tue Nov 03 2026 - 12:01:06 EST


lookup_get_column() stores the result of strchr() on a const string in
a plain char pointer. Since glibc 2.43, strchr() returns a const char
pointer for a const argument when C23 features are enabled, as they
are with _GNU_SOURCE, so gcc and clang warn:

lib/proc.c:61:16: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]

The pointer is only used to compute the length, so make it const.

Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
Found with gcc 16 and clang 21 on glibc 2.43; KernelCI's gcc 15 builds
show the same warning.

tools/testing/selftests/net/tcp_ao/lib/proc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/tcp_ao/lib/proc.c b/tools/testing/selftests/net/tcp_ao/lib/proc.c
index 8b984fa042869..50062b527a393 100644
--- a/tools/testing/selftests/net/tcp_ao/lib/proc.c
+++ b/tools/testing/selftests/net/tcp_ao/lib/proc.c
@@ -56,7 +56,7 @@ static struct netstat *lookup_get(struct netstat *ns,

static struct netstat *lookup_get_column(struct netstat *ns, const char *line)
{
- char *column;
+ const char *column;

column = strchr(line, ':');
if (!column)
--
2.53.0