From 22638fc4533d22bd8c5f187d21fa851d93a11488 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Sun, 28 Apr 2013 17:33:15 +0200 Subject: [PATCH] kconfig/conf: fix randconfig setting multiple symbols in a choice Currently, randconfig may set more than one symbol in a given choice. Given this config file: config A bool "A" if A choice bool "B/C/D" config B bool "B" config C bool "C" config D bool "D" endchoice endif # A Then randconfig generates such .config files (case where A is not set is not shown below for brevity), and where only the right-most .config is valid: CONFIG_A=y CONFIG_A=y CONFIG_A=y CONFIG_B=y CONFIG_B=y CONFIG_B=y CONFIG_C=y # CONFIG_C is not set # CONFIG_C is not set # CONFIG_D is not set CONFIG_D=y # CONFIG_D is not set That is, in a randomised choice, the first symbol is always selected, and at most one other symbol may be selected. This is due to symbol randomised in a choice not being properly flagged as having a value. Fix that by flagging those symbols adequately: have a user-defined value, and be not valid (to force recalculation of the symbol). Note: if the choice is not conditional, then the randomisation is properly done. Reported-by: Matthieu CASTET Signed-off-by: Matthieu CASTET [yann.morin.1998@free.fr: independently re-done the same patch as Matthieu, as pointed out by Sedat] Cc: Arnaud Lacombe Cc: Sedat Dilek Signed-off-by: "Yann E. MORIN" Signed-off-by: Christian Lamparter --- config/confdata.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/confdata.c b/config/confdata.c index bd7a229..4a88b8d 100644 --- a/config/confdata.c +++ b/config/confdata.c @@ -1140,6 +1140,9 @@ static void randomize_choice_values(struct symbol *csym) else { sym->def[S_DEF_USER].tri = no; } + sym->flags |= SYMBOL_DEF_USER; + /* clear VALID to get value calculated */ + sym->flags &= ~SYMBOL_VALID; } csym->flags |= SYMBOL_DEF_USER; /* clear VALID to get value calculated */ -- 2.31.1