Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kernel-hardening-checker
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-depend
kernel-hardening-checker
Commits
785747cd
Commit
785747cd
authored
Feb 26, 2023
by
Alexander Popov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix pylint warning: formatting a regular string which could be a f-string (IV)
Part IV, sys.exit()
parent
d6529e8d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
__init__.py
kconfig_hardened_check/__init__.py
+8
-8
No files found.
kconfig_hardened_check/__init__.py
View file @
785747cd
...
...
@@ -328,7 +328,7 @@ def detect_compiler(fname):
return
'CLANG '
+
clang_version
,
'OK'
if
gcc_version
!=
'0'
and
clang_version
==
'0'
:
return
'GCC '
+
gcc_version
,
'OK'
sys
.
exit
(
'[!] ERROR: invalid GCC_VERSION and CLANG_VERSION: {} {}'
.
format
(
gcc_version
,
clang_version
)
)
sys
.
exit
(
f
'[!] ERROR: invalid GCC_VERSION and CLANG_VERSION: {gcc_version} {clang_version}'
)
def
add_kconfig_checks
(
l
,
arch
):
...
...
@@ -943,14 +943,14 @@ def parse_kconfig_file(parsed_options, fname):
if
opt_is_on
.
match
(
line
):
option
,
value
=
line
.
split
(
'='
,
1
)
if
value
==
'is not set'
:
sys
.
exit
(
'[!] ERROR: bad enabled kconfig option "{}"'
.
format
(
line
)
)
sys
.
exit
(
f
'[!] ERROR: bad enabled kconfig option "{line}"'
)
elif
opt_is_off
.
match
(
line
):
option
,
value
=
line
[
2
:]
.
split
(
' '
,
1
)
if
value
!=
'is not set'
:
sys
.
exit
(
'[!] ERROR: bad disabled kconfig option "{}"'
.
format
(
line
)
)
sys
.
exit
(
f
'[!] ERROR: bad disabled kconfig option "{line}"'
)
if
option
in
parsed_options
:
sys
.
exit
(
'[!] ERROR: kconfig option "{}" exists multiple times'
.
format
(
line
)
)
sys
.
exit
(
f
'[!] ERROR: kconfig option "{line}" exists multiple times'
)
if
option
:
parsed_options
[
option
]
=
value
...
...
@@ -1016,7 +1016,7 @@ def parse_cmdline_file(parsed_options, fname):
line
=
f
.
readline
()
if
line
:
sys
.
exit
(
'[!] ERROR: more than one line in "{}"'
.
format
(
fname
)
)
sys
.
exit
(
f
'[!] ERROR: more than one line in "{fname}"'
)
for
opt
in
opts
:
if
'='
in
opt
:
...
...
@@ -1068,13 +1068,13 @@ def main():
arch
,
msg
=
detect_arch
(
args
.
config
,
supported_archs
)
if
not
arch
:
sys
.
exit
(
'[!] ERROR: {}'
.
format
(
msg
)
)
sys
.
exit
(
f
'[!] ERROR: {msg}'
)
if
mode
!=
'json'
:
print
(
f
'[+] Detected architecture: {arch}'
)
kernel_version
,
msg
=
detect_kernel_version
(
args
.
config
)
if
not
kernel_version
:
sys
.
exit
(
'[!] ERROR: {}'
.
format
(
msg
)
)
sys
.
exit
(
f
'[!] ERROR: {msg}'
)
if
mode
!=
'json'
:
print
(
f
'[+] Detected kernel version: {kernel_version[0]}.{kernel_version[1]}'
)
...
...
@@ -1123,7 +1123,7 @@ def main():
if
args
.
print
:
if
mode
in
(
'show_ok'
,
'show_fail'
):
sys
.
exit
(
'[!] ERROR: wrong mode "{}" for --print'
.
format
(
mode
)
)
sys
.
exit
(
f
'[!] ERROR: wrong mode "{mode}" for --print'
)
arch
=
args
.
print
add_kconfig_checks
(
config_checklist
,
arch
)
add_cmdline_checks
(
config_checklist
,
arch
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment