diff options
author | Li Zefan <lizefan@huawei.com> | 2013-05-07 17:56:54 +0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-07 18:55:36 +0400 |
commit | 383da76f5261637b8beacb99a83f5834b14fc432 (patch) | |
tree | d22fc5e9d1f8f2ae11b367caf9cbc11fc81cb3bb /scripts/kconfig/menu.c | |
parent | 2a437cd36e627752e9cac71bfec6293f1e4e4144 (diff) | |
download | linux-383da76f5261637b8beacb99a83f5834b14fc432.tar.xz |
menuconfig: fix NULL pointer dereference when searching a symbol
Searching for PPC_EFIKA results in a segmentation fault, and it's
because get_symbol_prop() returns NULL.
In this case CONFIG_PPC_EFIKA is defined in arch/powerpc/platforms/
52xx/Kconfig, so it won't be parsed if ARCH!=PPC, but menuconfig knows
this symbol when it parses sound/soc/fsl/Kconfig:
config SND_MPC52xx_SOC_EFIKA
tristate "SoC AC97 Audio support for bbplan Efika and STAC9766"
depends on PPC_EFIKA
This bug was introduced by commit bcdedcc1afd6 ("menuconfig: print more
info for symbol without prompts").
Reported-and-tested-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Li Zefan <lizefan@huawei.com>
Tested-by: Libo Chen <libo.chen@huawei.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/kconfig/menu.c')
-rw-r--r-- | scripts/kconfig/menu.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 826da662886d..b5c7d90df9df 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -600,14 +600,18 @@ void get_symbol_str(struct gstr *r, struct symbol *sym, } for_all_prompts(sym, prop) get_prompt_str(r, prop, head); + prop = get_symbol_prop(sym); - str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name, - prop->menu->lineno); - if (!expr_is_yes(prop->visible.expr)) { - str_append(r, _(" Depends on: ")); - expr_gstr_print(prop->visible.expr, r); - str_append(r, "\n"); + if (prop) { + str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name, + prop->menu->lineno); + if (!expr_is_yes(prop->visible.expr)) { + str_append(r, _(" Depends on: ")); + expr_gstr_print(prop->visible.expr, r); + str_append(r, "\n"); + } } + hit = false; for_all_properties(sym, prop, P_SELECT) { if (!hit) { |