linux/scripts/kconfig
Dirk Gouders e983b7b17a kconfig/menu.c: fix multiple references to expressions in menu_add_prop()
menu_add_prop() applies upper menus' visibilities to actual prompts
by AND-ing the prompts visibilities with the upper menus ones.

This creates a further reference to the menu's visibilities and when
the expression reduction functions do their work, they may remove or
modify expressions that have multiple references, thus causing
unpredictable side-effects.

The following example Kconfig constructs a case where this causes
problems: a menu and a prompt which's visibilities depend on the same
symbol.  When invoking mconf with this Kconfig and pressing "Z" we
see a problem caused by a free'd expression still referenced by the
menu's visibility:

------------------------------------------------------------------------
mainmenu "Kconfig Testing Configuration"

config VISIBLE
	def_bool n

config Placeholder
	bool "Place holder"

menu "Invisible"
	visible if VISIBLE

config TEST_VAR
	bool "Test option" if VISIBLE

endmenu
------------------------------------------------------------------------

This patch fixes this problem by creating copies of the menu's
visibility expressions before AND-ing them with the prompt's one.

Signed-off-by: Dirk Gouders <dirk@gouders.net>
[yann.morin.1998@free.fr: move variable into its block-scope,
                          keep lines <80 chars, typo]
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2013-05-30 00:14:01 +02:00
..
lxdialog mconf: handle keys in empty dialogs 2013-05-30 00:13:32 +02:00
.gitignore kconfig: remove lkc_defs.h from .gitignore and dontdiff 2012-07-13 15:08:25 +02:00
check.sh kbuild: Fix gcc -x syntax 2012-10-03 09:03:24 +02:00
conf.c kconfig: allow specifying the seed for randconfig 2013-04-25 00:16:25 +02:00
confdata.c Revert "kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG" 2013-04-26 23:21:59 +02:00
expr.c kconfig: Fix malloc handling in conf tools 2012-11-20 12:12:47 +01:00
expr.h menuconfig: Replace CIRCLEQ by list_head-style lists. 2012-10-25 15:06:00 +02:00
gconf.c kconfig: get CONFIG_ prefix from the environment 2012-11-20 11:20:08 +01:00
gconf.glade
images.c
kxgettext.c
list.h kconfig: fix lists definition for C++ 2013-04-29 19:55:56 +02:00
lkc_proto.h menuconfig: Replace CIRCLEQ by list_head-style lists. 2012-10-25 15:06:00 +02:00
lkc.h kconfig: Fix malloc handling in conf tools 2012-11-20 12:12:47 +01:00
Makefile kconfig: optionally use pkg-config to detect ncurses libs 2013-03-07 00:21:11 +01:00
mconf.c mconf: handle keys in empty dialogs 2013-05-30 00:13:32 +02:00
menu.c kconfig/menu.c: fix multiple references to expressions in menu_add_prop() 2013-05-30 00:14:01 +02:00
merge_config.sh merge_config.sh: Avoid creating unnessary source softlinks 2013-04-10 10:55:22 +02:00
nconf.c kconfig: nconf: rewrite labels of function keys line 2013-02-09 01:42:41 +01:00
nconf.gui.c nconf: function keys line, change background color for better readability 2013-01-24 11:43:44 +01:00
nconf.h
POTFILES.in
qconf.cc kconfig: fix a compiliation error when using make xconfig 2013-01-30 10:16:43 +01:00
qconf.h
streamline_config.pl localmodconfig: Process source kconfig files as they are found 2013-04-29 15:41:51 -04:00
symbol.c kconfig: Fix malloc handling in conf tools 2012-11-20 12:12:47 +01:00
util.c kconfig: Fix malloc handling in conf tools 2012-11-20 12:12:47 +01:00
zconf.gperf
zconf.hash.c_shipped
zconf.l kconfig: Fix malloc handling in conf tools 2012-11-20 12:12:47 +01:00
zconf.lex.c_shipped kconfig: Regenerate lexer 2012-11-20 12:12:57 +01:00
zconf.tab.c_shipped
zconf.y