diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-05-28 05:21:41 -0400 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-05-28 14:28:58 -0400 |
commit | bb222ceeb327a9bd484ba763fe86644f6d97e0cc (patch) | |
tree | 1cc9787c75bdebeee2e6a358833a4316c1d9b8c2 | |
parent | 104daea149c45cc84842ce77a9bd6436d19f3dd8 (diff) |
kconfig: remove string expansion in file_lookup()
There are two callers of file_lookup(), but there is no more reason
to expand the given path.
[1] zconf_initscan()
This is used to open the first Kconfig. sym_expand_string_value()
has never been used in a useful way here; before opening the first
Kconfig file, obviously there is no symbol to expand. If you use
expand_string_value() instead, environments in KBUILD_KCONFIG would
be expanded, but I do not see practical benefits for that.
[2] zconf_nextfile()
This is used to open the next file from 'source' statement.
Symbols in the path like "arch/$SRCARCH/Kconfig" needed expanding,
but it was replaced with the direct environment expansion. The
environment has already been expanded before the token is passed
to the parser.
By the way, file_lookup() was already buggy; it expanded a given path,
but it used the path before expansion for look-up:
if (!strcmp(name, file->name)) {
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Ulf Magnusson <ulfalizer@gmail.com>
-rw-r--r-- | scripts/kconfig/util.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c index 703ee4904613..a365594770d9 100644 --- a/scripts/kconfig/util.c +++ b/scripts/kconfig/util.c | |||
@@ -14,18 +14,16 @@ | |||
14 | struct file *file_lookup(const char *name) | 14 | struct file *file_lookup(const char *name) |
15 | { | 15 | { |
16 | struct file *file; | 16 | struct file *file; |
17 | char *file_name = sym_expand_string_value(name); | ||
18 | 17 | ||
19 | for (file = file_list; file; file = file->next) { | 18 | for (file = file_list; file; file = file->next) { |
20 | if (!strcmp(name, file->name)) { | 19 | if (!strcmp(name, file->name)) { |
21 | free(file_name); | ||
22 | return file; | 20 | return file; |
23 | } | 21 | } |
24 | } | 22 | } |
25 | 23 | ||
26 | file = xmalloc(sizeof(*file)); | 24 | file = xmalloc(sizeof(*file)); |
27 | memset(file, 0, sizeof(*file)); | 25 | memset(file, 0, sizeof(*file)); |
28 | file->name = file_name; | 26 | file->name = xstrdup(name); |
29 | file->next = file_list; | 27 | file->next = file_list; |
30 | file_list = file; | 28 | file_list = file; |
31 | return file; | 29 | return file; |