diff mbox

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

Message ID 1485891894-18949-3-git-send-email-jwcart2@tycho.nsa.gov (mailing list archive)
State Not Applicable
Headers show

Commit Message

James Carter Jan. 31, 2017, 7:44 p.m. UTC
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@tycho.nsa.gov>
---
 checkpolicy/module_compiler.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)
diff mbox

Patch

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;
 }