Add a sanity check and do minor refactoring
authorAlexander Popov <alex.popov@linux.com>
Tue, 12 Mar 2019 13:42:23 +0000 (16:42 +0300)
committerAlexander Popov <alex.popov@linux.com>
Tue, 12 Mar 2019 13:42:23 +0000 (16:42 +0300)
kconfig-hardened-check.py

index 6714f0570beed84adf26d54e6ad08b9017644bae..879ff7b6d9a6e34d7f8726e6c20abdd9b0f431be 100755 (executable)
@@ -101,9 +101,12 @@ class OR(ComplexOptCheck):
     #     OR(<X_is_hardened>, <X_is_hardened_old>)
 
     def check(self):
+        if not self.opts:
+            sys.exit('[!] ERROR: invalid OR check')
+
         for i, opt in enumerate(self.opts):
-            result, msg = opt.check()
-            if result:
+            ret, msg = opt.check()
+            if ret:
                 if i == 0:
                     self.result = opt.result
                 else: