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]
Date:   Tue, 24 Aug 2021 03:22:47 +0100
From:   Austin Kim <austindh.kim@...il.com>
To:     paul@...l-moore.com, stephen.smalley.work@...il.com,
        eparis@...isplace.org
Cc:     selinux@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel-team@....com, austin.kim@....com
Subject: [PATCH] selinux: remove duplicated initialization of 'i' for clean-up

From: Austin Kim <austin.kim@....com>

The local variable 'i' is used to be incremented inside while loop
within sidtab_convert_tree(). Before while loop, 'i' is set to 0 
inside if/else statement.

Since there is no 'goto' statement within sidtab_convert_tree(),
it had better initialize 'i' as 0 once before if/else statement.

Signed-off-by: Austin Kim <austin.kim@....com>
---
 security/selinux/ss/sidtab.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/security/selinux/ss/sidtab.c b/security/selinux/ss/sidtab.c
index 656d50b09f76..301620de63d3 100644
--- a/security/selinux/ss/sidtab.c
+++ b/security/selinux/ss/sidtab.c
@@ -374,7 +374,7 @@ static int sidtab_convert_tree(union sidtab_entry_inner *edst,
 			       struct sidtab_convert_params *convert)
 {
 	int rc;
-	u32 i;
+	u32 i = 0;
 
 	if (level != 0) {
 		if (!edst->ptr_inner) {
@@ -383,7 +383,6 @@ static int sidtab_convert_tree(union sidtab_entry_inner *edst,
 			if (!edst->ptr_inner)
 				return -ENOMEM;
 		}
-		i = 0;
 		while (i < SIDTAB_INNER_ENTRIES && *pos < count) {
 			rc = sidtab_convert_tree(&edst->ptr_inner->entries[i],
 						 &esrc->ptr_inner->entries[i],
@@ -400,7 +399,6 @@ static int sidtab_convert_tree(union sidtab_entry_inner *edst,
 			if (!edst->ptr_leaf)
 				return -ENOMEM;
 		}
-		i = 0;
 		while (i < SIDTAB_LEAF_ENTRIES && *pos < count) {
 			rc = convert->func(&esrc->ptr_leaf->entries[i].context,
 					   &edst->ptr_leaf->entries[i].context,
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ