lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 24 May 2022 19:52:21 -0700
From:   Peilin Ye <yepeilin.cs@...il.com>
To:     Stephen Hemminger <stephen@...workplumber.org>,
        David Ahern <dsahern@...nel.org>, netdev@...r.kernel.org
Cc:     Peilin Ye <peilin.ye@...edance.com>,
        Richard Haines <richard_c_haines@...nternet.com>,
        Cong Wang <cong.wang@...edance.com>,
        Peilin Ye <yepeilin.cs@...il.com>
Subject: [PATCH iproute2-next 3/7] ss: Do not call user_ent_hash_build() more than once

From: Peilin Ye <peilin.ye@...edance.com>

Call user_ent_hash_build() once after the getopt_long() loop if -p, -z
or -Z is used.

Signed-off-by: Peilin Ye <peilin.ye@...edance.com>
---
 misc/ss.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/misc/ss.c b/misc/ss.c
index bccf01bb5efa..dd7b67a76255 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -596,13 +596,6 @@ static void user_ent_hash_build(void)
 	char *pid_context;
 	char *sock_context;
 	const char *no_ctx = "unavailable";
-	static int user_ent_hash_build_init;
-
-	/* If show_users & show_proc_ctx set only do this once */
-	if (user_ent_hash_build_init != 0)
-		return;
-
-	user_ent_hash_build_init = 1;
 
 	strlcpy(name, root, sizeof(name));
 
@@ -5509,7 +5502,6 @@ int main(int argc, char *argv[])
 			break;
 		case 'p':
 			show_users++;
-			user_ent_hash_build();
 			break;
 		case 'b':
 			show_options = 1;
@@ -5644,7 +5636,6 @@ int main(int argc, char *argv[])
 				exit(1);
 			}
 			show_proc_ctx++;
-			user_ent_hash_build();
 			break;
 		case 'N':
 			if (netns_switch(optarg))
@@ -5679,6 +5670,9 @@ int main(int argc, char *argv[])
 		}
 	}
 
+	if (show_users || show_proc_ctx || show_sock_ctx)
+		user_ent_hash_build();
+
 	argc -= optind;
 	argv += optind;
 
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ