Commit 383da76f authored by Li Zefan's avatar Li Zefan Committed by Linus Torvalds

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 bcdedcc1 ("menuconfig: print more
info for symbol without prompts").
Reported-and-tested-by: default avatarBorislav Petkov <bp@alien8.de>
Signed-off-by: default avatarLi Zefan <lizefan@huawei.com>
Tested-by: default avatarLibo Chen <libo.chen@huawei.com>
Reviewed-by: default avatar"Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 2a437cd3
...@@ -600,14 +600,18 @@ void get_symbol_str(struct gstr *r, struct symbol *sym, ...@@ -600,14 +600,18 @@ void get_symbol_str(struct gstr *r, struct symbol *sym,
} }
for_all_prompts(sym, prop) for_all_prompts(sym, prop)
get_prompt_str(r, prop, head); get_prompt_str(r, prop, head);
prop = get_symbol_prop(sym); prop = get_symbol_prop(sym);
str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name, if (prop) {
prop->menu->lineno); str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name,
if (!expr_is_yes(prop->visible.expr)) { prop->menu->lineno);
str_append(r, _(" Depends on: ")); if (!expr_is_yes(prop->visible.expr)) {
expr_gstr_print(prop->visible.expr, r); str_append(r, _(" Depends on: "));
str_append(r, "\n"); expr_gstr_print(prop->visible.expr, r);
str_append(r, "\n");
}
} }
hit = false; hit = false;
for_all_properties(sym, prop, P_SELECT) { for_all_properties(sym, prop, P_SELECT) {
if (!hit) { if (!hit) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment