[PATCH 2/2] checkpolicy: Remove uneeded return check in require_symbol()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since symtab_insert() no longer returns -2 in the case of a
declaration of an identifier followed by a require of the same
symbol, remove the uneeded check.

Signed-off-by: James Carter <jwcart2@xxxxxxxxxxxxx>
---
 checkpolicy/module_compiler.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/checkpolicy/module_compiler.c b/checkpolicy/module_compiler.c
index 95e29be..a5be276 100644
--- a/checkpolicy/module_compiler.c
+++ b/checkpolicy/module_compiler.c
@@ -719,23 +719,15 @@ int require_symbol(uint32_t symbol_type,
 	avrule_decl_t *decl = stack_top->decl;
 	int ret = create_symbol(symbol_type, key, datum, dest_value, SCOPE_REQ);
 
-	if (ret == 0 || ret == 1) {
-		if (ebitmap_set_bit(decl->required.scope + symbol_type,
-				    *datum_value - 1, 1)) {
-			return -3;
-		}
-	} else if (ret == -2) {
-		/* ignore require statements if that symbol was
-		 * previously declared and is in current scope */
-		if (is_id_in_scope(symbol_type, key)) {
-			ret = 1;
-		} else {
-			return -2;
-		}
-	} else if (ret < 0) {
+	if (ret < 0) {
 		return ret;
 	}
 
+	if (ebitmap_set_bit(decl->required.scope + symbol_type,
+			    *datum_value - 1, 1)) {
+		return -3;
+	}
+
 	stack_top->require_given = 1;
 	return ret;
 }
-- 
2.7.4

_______________________________________________
Selinux mailing list
Selinux@xxxxxxxxxxxxx
To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx.
To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.



[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux