Skip to contentSkip to conversation

misc: ss.c: fix logical error in main function

PATCH Applied Anton Moryakov 3 participants 3 messages Jul 19, 2025 – Jul 29, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 misc: ss.c: fix logical error in main function

In the line if (!dump_tcpdiag) { there was a logical error in checking the descriptor, which the static analyzer complained about (this action is always false)

fixed by replacing !dump_tcpdiag with !dump_fp

Reported-by SVACE static analyzer
---
 misc/ss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
misc/ss.c +1 -1
index de02fccb..20d0766d 100644
@@ -6228,7 +6228,7 @@ int main(int argc, char *argv[])
 		}
 		if (dump_tcpdiag[0] != '-') {
 			dump_fp = fopen(dump_tcpdiag, "w");
-			if (!dump_tcpdiag) {
+			if (!dump_fp) {
 				perror("fopen dump file");
 				exit(-1);
 			}
Signature · 1 line
2.39.2
#2 lore raw
In reply to Anton Moryakov
This patch was applied to iproute2/iproute2-next.git (main) by David Ahern <[email protected]>:

Hello:

This patch was applied to iproute2/iproute2-next.git (main) by David Ahern <[email protected]>:

Quoted 10 lines · On Sat, 19 Jul 2025 19:31:22 +0300 you wrote:

In the line if (!dump_tcpdiag) { there was a logical error in checking the descriptor, which the static analyzer complained about (this action is always false)

fixed by replacing !dump_tcpdiag with !dump_fp

Reported-by SVACE static analyzer

[...]

Here is the summary with links:
- [iproute2-next] misc: ss.c: fix logical error in main function

    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=27d11a81197c

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html