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-next>] [day] [month] [year] [list]
Message-ID: <20241125105926.47141-1-cgoettsche@seltendoof.de>
Date: Mon, 25 Nov 2024 11:59:23 +0100
From: Christian Göttsche <cgoettsche@...tendoof.de>
To: 
Cc: Christian Göttsche <cgzones@...glemail.com>,
	Paul Moore <paul@...l-moore.com>,
	James Morris <jmorris@...ei.org>,
	"Serge E. Hallyn" <serge@...lyn.com>,
	Nathan Chancellor <nathan@...nel.org>,
	Nick Desaulniers <ndesaulniers@...gle.com>,
	Bill Wendling <morbo@...gle.com>,
	Justin Stitt <justinstitt@...gle.com>,
	linux-security-module@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	llvm@...ts.linux.dev
Subject: [PATCH 2/2] lsm: rename variable to avoid shadowing

From: Christian Göttsche <cgzones@...glemail.com>

The function dump_common_audit_data() contains two variables with the
name comm: one declared at the top and one nested one.
Rename the nested variable to improve readability and make future refactorings
of the function less error prone.

Reported by clang:

    security/lsm_audit.c:302:10: error: declaration shadows a local variable [-Werror,-Wshadow]
      302 |                                 char comm[sizeof(tsk->comm)];
          |                                      ^
    security/lsm_audit.c:200:7: note: previous declaration is here
      200 |         char comm[sizeof(current->comm)];
          |              ^

Signed-off-by: Christian Göttsche <cgzones@...glemail.com>
---
 security/lsm_audit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/security/lsm_audit.c b/security/lsm_audit.c
index f1fe99f2221d..429096bf8fe0 100644
--- a/security/lsm_audit.c
+++ b/security/lsm_audit.c
@@ -299,10 +299,10 @@ static void dump_common_audit_data(struct audit_buffer *ab,
 		if (tsk) {
 			pid_t pid = task_tgid_nr(tsk);
 			if (pid) {
-				char comm[sizeof(tsk->comm)];
+				char tskcomm[sizeof(tsk->comm)];
 				audit_log_format(ab, " opid=%d ocomm=", pid);
 				audit_log_untrustedstring(ab,
-				    memcpy(comm, tsk->comm, sizeof(comm)));
+				    memcpy(tskcomm, tsk->comm, sizeof(tskcomm)));
 			}
 		}
 		break;
-- 
2.45.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ