Commit 7e557a2509f9e1477c10295b74e29e4e93fa2392
1 parent
46b8af50ba
Exists in
master
and in
4 other branches
kbuild: check for leaked CONFIG_ symbols to userspace
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Showing 1 changed file with 10 additions and 1 deletions Side-by-side Diff
scripts/headers_check.pl
... | ... | @@ -16,7 +16,7 @@ |
16 | 16 | # |
17 | 17 | # 2) It is checked that prototypes does not use "extern" |
18 | 18 | # |
19 | -# 3) TODO: check for leaked CONFIG_ symbols | |
19 | +# 3) Check for leaked CONFIG_ symbols | |
20 | 20 | |
21 | 21 | use strict; |
22 | 22 | |
... | ... | @@ -36,6 +36,7 @@ |
36 | 36 | $lineno++; |
37 | 37 | check_include(); |
38 | 38 | check_prototypes(); |
39 | + check_config(); | |
39 | 40 | } |
40 | 41 | close FH; |
41 | 42 | } |
... | ... | @@ -62,6 +63,13 @@ |
62 | 63 | { |
63 | 64 | if ($line =~ m/^\s*extern\b/) { |
64 | 65 | printf STDERR "$filename:$lineno: extern's make no sense in userspace\n"; |
66 | + } | |
67 | +} | |
68 | + | |
69 | +sub check_config | |
70 | +{ | |
71 | + if ($line =~ m/[^a-zA-Z0-9_]+CONFIG_([a-zA-Z0-9]+)[^a-zA-Z0-9]/) { | |
72 | + printf STDERR "$filename:$lineno: leaks CONFIG_$1 to userspace where it is not valid\n"; | |
65 | 73 | } |
66 | 74 | } |