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]
Message-Id: <b5cb2ea504c1c4d24743448f71fb4897ea0122d2.1653446538.git.peilin.ye@bytedance.com>
Date:   Tue, 24 May 2022 19:52:09 -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 2/7] ss: Remove unnecessary stack variable 'p' in user_ent_hash_build()

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

Commit 116ac9270b6d ("ss: Add support for retrieving SELinux contexts")
added an unnecessary stack variable, 'char *p', in
user_ent_hash_build().  Delete it for readability.

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

diff --git a/misc/ss.c b/misc/ss.c
index aa9da7e45e53..bccf01bb5efa 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -618,7 +618,6 @@ static void user_ent_hash_build(void)
 	while ((d = readdir(dir)) != NULL) {
 		struct dirent *d1;
 		char process[16];
-		char *p;
 		int pid, pos;
 		DIR *dir1;
 
@@ -636,7 +635,6 @@ static void user_ent_hash_build(void)
 		}
 
 		process[0] = '\0';
-		p = process;
 
 		while ((d1 = readdir(dir1)) != NULL) {
 			const char *pattern = "socket:[";
@@ -667,18 +665,18 @@ static void user_ent_hash_build(void)
 			if (getfilecon(tmp, &sock_context) <= 0)
 				sock_context = strdup(no_ctx);
 
-			if (*p == '\0') {
+			if (process[0] == '\0') {
 				FILE *fp;
 
 				snprintf(tmp, sizeof(tmp), "%s/%d/stat",
 					root, pid);
 				if ((fp = fopen(tmp, "r")) != NULL) {
-					if (fscanf(fp, "%*d (%[^)])", p) < 1)
+					if (fscanf(fp, "%*d (%[^)])", process) < 1)
 						; /* ignore */
 					fclose(fp);
 				}
 			}
-			user_ent_add(ino, p, pid, fd,
+			user_ent_add(ino, process, pid, fd,
 					pid_context, sock_context);
 			freecon(sock_context);
 		}
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ