selftests/net: tcp_mmap: remove unused -k option and keepflag
Subsystems (3)
PATCH 1/1 selftests/net: tcp_mmap: remove unused -k option and keepflag
Commit aacb0c2e524c ("selftests: net: tcp_mmap must use TCP_ZEROCOPY_RECEIVE") removed the only read of keepflag in child_thread(), leaving the file-scope keepflag variable set by the -k option in main() but never read. This triggers a Clang 23 warning:
tcp_mmap.c:91:12: error: variable 'keepflag' set but not used [-Werror,-Wunused-but-set-global]
Remove the unused keepflag variable and the dead -k getopt option.
--- tools/testing/selftests/net/tcp_mmap.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
tools/testing/selftests/net/tcp_mmap.c +1 -5
@@ -85,7 +85,6 @@ static int rcvbuf; /* Default: autotuning. Can be set with -r <integer> optionstatic int sndbuf;/* Default: autotuning. Can be set with -w <integer> option */ static int zflg;/* zero copy option. (MSG_ZEROCOPY for sender, mmap() for receiver */ static int xflg;/* hash received data (simple xor) (-h option) */ -static int keepflag;/* -k option: receiver shall keep all received file in memory (no munmap() calls) */ static int integrity;/* -i option: sender and receiver compute sha256 over the data.*/ static size_t chunk_size =512 *1024 ;
@@ -456,7 +455,7 @@ int main(int argc, char *argv[])int sflg =0 ;int mss =0 ; -while ((c =getopt (argc, argv,"46p:svr:w:H:zxkP:M:C:a:i" )) !=-1 ) { +while ((c =getopt (argc, argv,"46p:svr:w:H:zxP:M:C:a:i" )) !=-1 ) {switch (c) {case '4' : cfg_family =PF_INET ;
@@ -490,9 +489,6 @@ int main(int argc, char *argv[])case 'x' : xflg =1 ;break ; -case 'k' : - keepflag =1 ; -break ;case 'P' : max_pacing_rate =atoi (optarg) ;break ;
Signature · 1 line
2.56.0.212.g129ede20d9-goog
Quoted 6 lines · Greg Thelen
Commit
aacb0c2e524c("selftests: net:tcp_mmapmust useTCP_ZEROCOPY_RECEIVE") removed the only read of keepflag inchild_thread(), leaving the file-scope keepflag variable set by the -k option inmain()but never read. This triggers a Clang 23 warning:
Quoted 7 lines
tcp_mmap.c:91:12: error: variable 'keepflag' set but not used [-Werror,-Wunused-but-set-global]
Remove the unused keepflag variable and the dead -k getopt option.
Fixes aacb0c2e524c ("selftests: net: tcp_mmap must use TCP_ZEROCOPY_RECEIVE")Signed-off-by Greg Thelen <[email protected]>
Thanks!
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Wed, 21 Oct 2026 08:26:58 -0700 you wrote:
Commit
aacb0c2e524c("selftests: net:tcp_mmapmust useTCP_ZEROCOPY_RECEIVE") removed the only read of keepflag inchild_thread(), leaving the file-scope keepflag variable set by the -k option inmain()but never read. This triggers a Clang 23 warning:tcp_mmap.c:91:12: error: variable 'keepflag' set but not used [-Werror,-Wunused-but-set-global]
[...]
Here is the summary with links:
- [net] selftests/net: tcp_mmap: remove unused -k option and keepflag
https://git.kernel.org/netdev/net/c/5536d5553f27
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html