mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hangbin Liu <hangbin.liu@linux.dev>
To: Sasha Levin <sashal@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	Dmitry Safonov <0x7f454c46@gmail.com>,
	Shuah Khan <shuah@kernel.org>,
	netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] selftests: net: tcp_ao: make the netstat column pointer const
Date: Wed, 4 Nov 2026 09:48:21 +0800	[thread overview]
Message-ID: <auqO5W4-hhd1brHi@fedora> (raw)
In-Reply-To: <20261103165419.687806-6-sashal@kernel.org>

On Tue, Nov 03, 2026 at 11:54:19AM -0500, Sasha Levin wrote:
> 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@kernel.org>
> ---
> 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
> 

Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>

      reply	other threads:[~2026-11-04  1:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 16:54 [PATCH] selftests/fs/mount-notify: fix the indentation in the fsmount test Sasha Levin
2026-11-03 16:54 ` [PATCH] selftests/filesystems: remove the unused list_del() Sasha Levin
2026-11-03 16:54 ` [PATCH] selftests/statmount: initialize the byte written to the child Sasha Levin
2026-11-03 16:54 ` [PATCH] selftests/namespaces: initialize the byte the children write Sasha Levin
2026-11-03 16:54 ` [PATCH nf-next] selftests: netfilter: nf_queue: drop the no-op loop initializer Sasha Levin
2026-11-04  1:49   ` Hangbin Liu
2026-11-03 16:54 ` [PATCH net-next] selftests: net: tcp_ao: make the netstat column pointer const Sasha Levin
2026-11-04  1:48   ` Hangbin Liu [this message]

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=auqO5W4-hhd1brHi@fedora \
    --to=hangbin.liu@linux.dev \
    --cc=0x7f454c46@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sashal@kernel.org \
    --cc=shuah@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 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®