Blame SOURCES/0006-checkpolicy-simplify-assignment.patch

83845a
From 7cdb2a8fd2af0a063d6e505fd1250ca10ebbea11 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:23 +0200
83845a
Subject: [PATCH] checkpolicy: simplify assignment
83845a
MIME-Version: 1.0
83845a
Content-Type: text/plain; charset=UTF-8
83845a
Content-Transfer-Encoding: 8bit
83845a
83845a
checkpolicy.c:504:20: style: The statement 'if (policyvers!=n) policyvers=n' is logically equivalent to 'policyvers=n'. [duplicateConditionalAssign]
83845a
    if (policyvers != n)
83845a
                   ^
83845a
checkpolicy.c:505:17: note: Assignment 'policyvers=n'
83845a
     policyvers = n;
83845a
                ^
83845a
checkpolicy.c:504:20: note: Condition 'policyvers!=n' is redundant
83845a
    if (policyvers != n)
83845a
                   ^
83845a
83845a
Found by Cppcheck
83845a
83845a
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
83845a
---
83845a
 checkpolicy/checkpolicy.c | 3 +--
83845a
 1 file changed, 1 insertion(+), 2 deletions(-)
83845a
83845a
diff --git a/checkpolicy/checkpolicy.c b/checkpolicy/checkpolicy.c
83845a
index 8af31db5c6b7..b52595a87b29 100644
83845a
--- a/checkpolicy/checkpolicy.c
83845a
+++ b/checkpolicy/checkpolicy.c
83845a
@@ -504,8 +504,7 @@ int main(int argc, char **argv)
83845a
 					usage(argv[0]);
83845a
 					exit(1);
83845a
 				}
83845a
-				if (policyvers != n)
83845a
-					policyvers = n;
83845a
+				policyvers = n;
83845a
 				break;
83845a
 			}
83845a
 		case 'E':
83845a
-- 
83845a
2.32.0
83845a