Fix style (I)
[kconfig-hardened-check.git] / kernel_hardening_checker / __init__.py
index 7cd3957565b9f14b9e1e35a735d9fa12263c4825..597a964eea63a3a2a01df794e6e65b25504a0905 100644 (file)
@@ -150,7 +150,7 @@ def print_checklist(mode, checklist, with_results):
         print(f'[+] Config check is finished: \'OK\' - {ok_count}{ok_suppressed} / \'FAIL\' - {fail_count}{fail_suppressed}')
 
 
-def parse_kconfig_file(mode, parsed_options, fname):
+def parse_kconfig_file(_mode, parsed_options, fname):
     with _open(fname, 'rt', encoding='utf-8') as f:
         opt_is_on = re.compile(r"CONFIG_[a-zA-Z0-9_]+=.+$")
         opt_is_off = re.compile(r"# CONFIG_[a-zA-Z0-9_]+ is not set$")
@@ -281,7 +281,7 @@ def main():
         else:
             kernel_version, msg = detect_kernel_version(args.config)
         if kernel_version is None:
-            if not args.kernel_version:
+            if args.kernel_version is None:
                 print('[!] Hint: provide the kernel version file through --kernel-version option')
             sys.exit(f'[!] ERROR: {msg}')
         if mode != 'json':
@@ -405,6 +405,8 @@ def main():
         for opt in config_checklist:
             if opt.name == 'CONFIG_ARCH_MMAP_RND_BITS':
                 continue # don't add CONFIG_ARCH_MMAP_RND_BITS because its value needs refinement
+            if opt.expected == 'is not off':
+                continue # don't add Kconfig options without explicitly recommended values
             if opt.expected == 'is not set':
                 print(f'# {opt.name} is not set')
             else: