Skip to content

Commit 383da76

Browse files
lizf-ostorvalds
authored andcommitted
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 bcdedcc ("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>
1 parent 2a437cd commit 383da76

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

‎scripts/kconfig/menu.c‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -600,14 +600,18 @@ void get_symbol_str(struct gstr *r, struct symbol *sym,
600600
}
601601
for_all_prompts(sym, prop)
602602
get_prompt_str(r, prop, head);
603+
603604
prop = get_symbol_prop(sym);
604-
str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name,
605-
prop->menu->lineno);
606-
if (!expr_is_yes(prop->visible.expr)) {
607-
str_append(r, _(" Depends on: "));
608-
expr_gstr_print(prop->visible.expr, r);
609-
str_append(r, "\n");
605+
if (prop) {
606+
str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name,
607+
prop->menu->lineno);
608+
if (!expr_is_yes(prop->visible.expr)) {
609+
str_append(r, _(" Depends on: "));
610+
expr_gstr_print(prop->visible.expr, r);
611+
str_append(r, "\n");
612+
}
610613
}
614+
611615
hit = false;
612616
for_all_properties(sym, prop, P_SELECT) {
613617
if (!hit) {

0 commit comments

Comments
 (0)