android_kernel_sony_sdm845/scripts/kconfig
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Mihai Moldovan 01d09d4135 kconfig: nconf: stop endless search loops
[ Upstream commit 8c94b430b9f6213dec84e309bb480a71778c4213 ]

If the user selects the very first entry in a page and performs a
search-up operation, or selects the very last entry in a page and
performs a search-down operation that will not succeed (e.g., via
[/]asdfzzz[Up Arrow]), nconf will never terminate searching the page.

The reason is that in this case, the starting point will be set to -1
or n, which is then translated into (n - 1) (i.e., the last entry of
the page) or 0 (i.e., the first entry of the page) and finally the
search begins. This continues to work fine until the index reaches 0 or
(n - 1), at which point it will be decremented to -1 or incremented to
n, but not checked against the starting point right away. Instead, it's
wrapped around to the bottom or top again, after which the starting
point check occurs... and naturally fails.

My original implementation added another check for -1 before wrapping
the running index variable around, but Masahiro Yamada pointed out that
the actual issue is that the comparison point (starting point) exceeds
bounds (i.e., the [0,n-1] interval) in the first place and that,
instead, the starting point should be fixed.

This has the welcome side-effect of also fixing the case where the
starting point was n while searching down, which also lead to an
infinite loop.

OTOH, this code is now essentially all his work.

Amazingly, nobody seems to have been hit by this for 11 years - or at
the very least nobody bothered to debug and fix this.

Signed-off-by: Mihai Moldovan <ionic@ionic.de>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-22 10:40:30 +02:00
..
lxdialog kconfig/[mn]conf: handle backspace (^H) key 2019-05-04 08:49:10 +02:00
.gitignore
check.sh
conf.c kconfig: allow kconfig to handle longer path names 2015-12-10 11:06:10 +01:00
confdata.c kconfig: fix broken dependency in randconfig-generated .config 2020-02-28 15:42:22 +01:00
expr.c kconfig: don't crash on NULL expressions in expr_eq() 2020-01-12 11:24:24 +01:00
expr.h
gconf.c
gconf.glade
images.c
kxgettext.c
list.h
lkc.h
lkc_proto.h
Makefile kbuild: make sure autoksyms.h exists early 2016-12-01 10:19:22 -08:00
mconf.c
menu.c kconfig: Fix automatic menu creation mem leak 2018-05-30 07:50:20 +02:00
merge_config.sh kconfig/merge_config.sh: Accept a single file 2015-10-14 16:19:37 +02:00
nconf.c kconfig: nconf: stop endless search loops 2021-05-22 10:40:30 +02:00
nconf.gui.c kconfig/[mn]conf: handle backspace (^H) key 2019-05-04 08:49:10 +02:00
nconf.h
POTFILES.in
qconf.cc kconfig: fix qconf segfault by deleting heap objects 2016-01-11 09:45:08 +01:00
qconf.h Port xconfig to Qt5 - Source format. 2015-10-14 14:59:03 +02:00
streamline_config.pl localmodconfig: Fix whitespace repeat count after "tristate" 2016-04-26 18:35:16 -04:00
symbol.c kconfig/symbol.c: handle choice_values that depend on 'm' symbols 2016-05-10 21:14:27 +02:00
util.c
zconf.gperf
zconf.hash.c_shipped
zconf.l kconfig: fix memory leak when EOF is encountered in quotation 2019-01-26 09:38:34 +01:00
zconf.lex.c_shipped
zconf.tab.c_shipped
zconf.y kconfig: Don't leak main menus during parsing 2018-05-30 07:50:20 +02:00