Netdev List
 help / color / mirror / Atom feed
* [PATCH nf-next] selftests: netfilter: nf_queue: drop the no-op loop initializer
       [not found] <20261103165419.687806-1-sashal@kernel.org>
@ 2026-11-03 16:54 ` Sasha Levin
  2026-11-04  1:49   ` Hangbin Liu
  2026-11-04  8:37   ` Fernando Fernandez Mancera
  2026-11-03 16:54 ` [PATCH net-next] selftests: net: tcp_ao: make the netstat column pointer const Sasha Levin
  1 sibling, 2 replies; 6+ messages in thread
From: Sasha Levin @ 2026-11-03 16:54 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Florian Westphal
  Cc: Sasha Levin, Phil Sutter, Fernando Fernandez Mancera,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Shuah Khan, Nathan Chancellor, netfilter-devel,
	coreteam, netdev, linux-kselftest, llvm, linux-kernel

The out-of-order verdict loop starts with "for (ooo_count; ...", and
clang warns about the unused expression:

  nf_queue.c:354:10: warning: expression result unused [-Wunused-value]

Leave the initializer empty.

Signed-off-by: Sasha Levin <sashal@kernel.org>
---
KernelCI's clang builds show this warning.

 tools/testing/selftests/net/netfilter/nf_queue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/netfilter/nf_queue.c b/tools/testing/selftests/net/netfilter/nf_queue.c
index cca6c3cfa9e46..bc0b2f601a0a4 100644
--- a/tools/testing/selftests/net/netfilter/nf_queue.c
+++ b/tools/testing/selftests/net/netfilter/nf_queue.c
@@ -351,7 +351,7 @@ static int mainloop(void)
 		if (opts.out_of_order) {
 			ooo_ids[ooo_count] = id;
 			if (ooo_count >= 15) {
-				for (ooo_count; ooo_count >= 0; ooo_count--) {
+				for (; ooo_count >= 0; ooo_count--) {
 					nlh = nfq_build_verdict(buf, ooo_ids[ooo_count],
 								opts.queue_num, opts.verdict);
 					if (mnl_socket_sendto(nl, nlh, nlh->nlmsg_len) < 0) {
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next] selftests: net: tcp_ao: make the netstat column pointer const
       [not found] <20261103165419.687806-1-sashal@kernel.org>
  2026-11-03 16:54 ` [PATCH nf-next] selftests: netfilter: nf_queue: drop the no-op loop initializer Sasha Levin
@ 2026-11-03 16:54 ` Sasha Levin
  2026-11-04  1:48   ` Hangbin Liu
  2026-11-04 13:46   ` Dmitry Safonov
  1 sibling, 2 replies; 6+ messages in thread
From: Sasha Levin @ 2026-11-03 16:54 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Sasha Levin, Simon Horman, Dmitry Safonov, Shuah Khan, netdev,
	linux-kselftest, linux-kernel

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] selftests: net: tcp_ao: make the netstat column pointer const
  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
  2026-11-04 13:46   ` Dmitry Safonov
  1 sibling, 0 replies; 6+ messages in thread
From: Hangbin Liu @ 2026-11-04  1:48 UTC (permalink / raw)
  To: Sasha Levin
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Dmitry Safonov, Shuah Khan, netdev, linux-kselftest,
	linux-kernel

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>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH nf-next] selftests: netfilter: nf_queue: drop the no-op loop initializer
  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-04  8:37   ` Fernando Fernandez Mancera
  1 sibling, 0 replies; 6+ messages in thread
From: Hangbin Liu @ 2026-11-04  1:49 UTC (permalink / raw)
  To: Sasha Levin
  Cc: Pablo Neira Ayuso, Florian Westphal, Phil Sutter,
	Fernando Fernandez Mancera, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman, Shuah Khan,
	Nathan Chancellor, netfilter-devel, coreteam, netdev,
	linux-kselftest, llvm, linux-kernel

On Tue, Nov 03, 2026 at 11:54:18AM -0500, Sasha Levin wrote:
> The out-of-order verdict loop starts with "for (ooo_count; ...", and
> clang warns about the unused expression:
> 
>   nf_queue.c:354:10: warning: expression result unused [-Wunused-value]
> 
> Leave the initializer empty.
> 
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
> KernelCI's clang builds show this warning.
> 
>  tools/testing/selftests/net/netfilter/nf_queue.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/net/netfilter/nf_queue.c b/tools/testing/selftests/net/netfilter/nf_queue.c
> index cca6c3cfa9e46..bc0b2f601a0a4 100644
> --- a/tools/testing/selftests/net/netfilter/nf_queue.c
> +++ b/tools/testing/selftests/net/netfilter/nf_queue.c
> @@ -351,7 +351,7 @@ static int mainloop(void)
>  		if (opts.out_of_order) {
>  			ooo_ids[ooo_count] = id;
>  			if (ooo_count >= 15) {
> -				for (ooo_count; ooo_count >= 0; ooo_count--) {
> +				for (; ooo_count >= 0; ooo_count--) {
>  					nlh = nfq_build_verdict(buf, ooo_ids[ooo_count],
>  								opts.queue_num, opts.verdict);
>  					if (mnl_socket_sendto(nl, nlh, nlh->nlmsg_len) < 0) {
> -- 
> 2.53.0
> 

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH nf-next] selftests: netfilter: nf_queue: drop the no-op loop initializer
  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-04  8:37   ` Fernando Fernandez Mancera
  1 sibling, 0 replies; 6+ messages in thread
From: Fernando Fernandez Mancera @ 2026-11-04  8:37 UTC (permalink / raw)
  To: Sasha Levin, Pablo Neira Ayuso, Florian Westphal
  Cc: Phil Sutter, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman, Shuah Khan, Nathan Chancellor,
	netfilter-devel, coreteam, netdev, linux-kselftest, llvm,
	linux-kernel

On 11/3/26 5:54 PM, Sasha Levin wrote:
> The out-of-order verdict loop starts with "for (ooo_count; ...", and
> clang warns about the unused expression:
> 
>    nf_queue.c:354:10: warning: expression result unused [-Wunused-value]
> 
> Leave the initializer empty.
> 
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
> KernelCI's clang builds show this warning.
> 
>   tools/testing/selftests/net/netfilter/nf_queue.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/net/netfilter/nf_queue.c b/tools/testing/selftests/net/netfilter/nf_queue.c
> index cca6c3cfa9e46..bc0b2f601a0a4 100644
> --- a/tools/testing/selftests/net/netfilter/nf_queue.c
> +++ b/tools/testing/selftests/net/netfilter/nf_queue.c
> @@ -351,7 +351,7 @@ static int mainloop(void)
>   		if (opts.out_of_order) {
>   			ooo_ids[ooo_count] = id;
>   			if (ooo_count >= 15) {
> -				for (ooo_count; ooo_count >= 0; ooo_count--) {
> +				for (; ooo_count >= 0; ooo_count--) {
>   					nlh = nfq_build_verdict(buf, ooo_ids[ooo_count],
>   								opts.queue_num, opts.verdict);
>   					if (mnl_socket_sendto(nl, nlh, nlh->nlmsg_len) < 0) {

Reviewed-by: Fernando Fernandez Mancera <fmancera@suse.de>

Thanks!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] selftests: net: tcp_ao: make the netstat column pointer const
  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
@ 2026-11-04 13:46   ` Dmitry Safonov
  1 sibling, 0 replies; 6+ messages in thread
From: Dmitry Safonov @ 2026-11-04 13:46 UTC (permalink / raw)
  To: Sasha Levin
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Shuah Khan, netdev, linux-kselftest, linux-kernel

On Tue, 3 Nov 2026 at 16:54, Sasha Levin <sashal@kernel.org> 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>


Acked-by: Dmitry Safonov <0x7f454c46@gmail.com>

Thanks!

> ---
> 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
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-04 13:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20261103165419.687806-1-sashal@kernel.org>
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-04  8:37   ` Fernando Fernandez Mancera
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
2026-11-04 13:46   ` Dmitry Safonov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox