Blame SOURCES/0007-checkpolicy-drop-dead-condition.patch

83845a
From db674bf2186b34a3712e2069c769131503dcb9ff Mon Sep 17 00:00:00 2001
83845a
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
83845a
Date: Tue, 6 Jul 2021 19:54:24 +0200
83845a
Subject: [PATCH] checkpolicy: drop dead condition
83845a
MIME-Version: 1.0
83845a
Content-Type: text/plain; charset=UTF-8
83845a
Content-Transfer-Encoding: 8bit
83845a
83845a
The variable `id` is guaranteed to be non-NULL due to the preceding
83845a
while condition.
83845a
83845a
    policy_define.c:1171:7: style: Condition '!id' is always false [knownConditionTrueFalse]
83845a
      if (!id) {
83845a
          ^
83845a
    policy_define.c:1170:13: note: Assuming that condition 'id=queue_remove(id_queue)' is not redundant
83845a
     while ((id = queue_remove(id_queue))) {
83845a
                ^
83845a
    policy_define.c:1171:7: note: Condition '!id' is always false
83845a
      if (!id) {
83845a
          ^
83845a
83845a
Found by Cppcheck.
83845a
83845a
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
83845a
---
83845a
 checkpolicy/policy_define.c | 5 -----
83845a
 1 file changed, 5 deletions(-)
83845a
83845a
diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c
83845a
index 16234f31bbc3..7eff747adacf 100644
83845a
--- a/checkpolicy/policy_define.c
83845a
+++ b/checkpolicy/policy_define.c
83845a
@@ -1168,11 +1168,6 @@ int expand_attrib(void)
83845a
 
83845a
 	ebitmap_init(&attrs);
83845a
 	while ((id = queue_remove(id_queue))) {
83845a
-		if (!id) {
83845a
-			yyerror("No attribute name for expandattribute statement?");
83845a
-			goto exit;
83845a
-		}
83845a
-
83845a
 		if (!is_id_in_scope(SYM_TYPES, id)) {
83845a
 			yyerror2("attribute %s is not within scope", id);
83845a
 			goto exit;
83845a
-- 
83845a
2.32.0
83845a