WSL2-Linux-Kernel/scripts/kconfig
Masahiro Yamada 7a263a0402 kconfig: fix segmentation fault in menuconfig search
Since commit d05377e184 ("kconfig: Create links to main menu items
in search"), menuconfig shows a jump key next to "Main menu" if the
nearest visible parent is the rootmenu. If you press that jump key,
menuconfig crashes with a segmentation fault.

For example, do this:

  $ make ARCH=arm64 allnoconfig menuconfig

Press '/' to search for the string "ACPI". Press '1' to choose
"(1) Main menu". Then, menuconfig crashed with a segmentation fault.

The following code in search_conf()

    conf(targets[i]->parent, targets[i]);

results in NULL pointer dereference because targets[i] is the rootmenu,
which does not have a parent.

Commit d05377e184 tried to fix the issue of top-level items not having
a jump key, but adding the "Main menu" was not the right fix.

The correct fix is to show the searched item itself. This fixes another
weird behavior described in the comment block.

Fixes: d05377e184 ("kconfig: Create links to main menu items in search")
Reported-by: Johannes Zink <j.zink@pengutronix.de>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Tested-by: Bagas Sanjaya <bagasdotme@gmail.com>
Tested-by: Johannes Zink <j.zink@pengutronix.de>
2022-11-02 17:32:05 +09:00
..
lxdialog
tests
.gitignore
Makefile
conf.c
confdata.c
expr.c
expr.h
gconf-cfg.sh
gconf.c
gconf.glade
images.c
images.h
internal.h
lexer.l
list.h
lkc.h
lkc_proto.h
mconf-cfg.sh
mconf.c
menu.c
merge_config.sh
nconf-cfg.sh
nconf.c
nconf.gui.c
nconf.h
parser.y
preprocess.c
qconf-cfg.sh
qconf.cc
qconf.h
streamline_config.pl
symbol.c
util.c