Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kconfig: forbid multiple entries with the same symbol in a choice

Commit 6a859f1a19d1 ("powerpc: unify two CONFIG_POWERPC64_CPU entries
in the same choice block") removed the only occurrence of this tricky
use case.

Disallow this pattern in choice_check_sanity() and revert commit
4d46b5b623e0 ("kconfig: fix infinite loop in sym_calc_choice()").

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Link: https://patch.msgid.link/20260330115736.1559962-1-masahiroy@kernel.org
Reviewed-by: Nicolas Schier <nsc@kernel.org>
Signed-off-by: Nicolas Schier <nsc@kernel.org>

authored by

Masahiro Yamada and committed by
Nicolas Schier
d13a089d 2fb62d91

+4 -11
+4 -11
scripts/kconfig/parser.y
··· 159 159 yynerrs++; 160 160 } 161 161 162 - /* 163 - * If the same symbol appears twice in a choice block, the list 164 - * node would be added twice, leading to a broken linked list. 165 - * list_empty() ensures that this symbol has not yet added. 166 - */ 167 - if (list_empty(&current_entry->sym->choice_link)) 168 - list_add_tail(&current_entry->sym->choice_link, 169 - &current_choice->choice_members); 162 + list_add_tail(&current_entry->sym->choice_link, 163 + &current_choice->choice_members); 170 164 } 171 165 172 166 printd(DEBUG_PARSE, "%s:%d:endconfig\n", cur_filename, cur_lineno); ··· 540 546 ret = -1; 541 547 } 542 548 543 - if (prop->menu != menu && prop->type == P_PROMPT && 544 - prop->menu->parent != menu->parent) { 549 + if (prop->menu != menu && prop->type == P_PROMPT) { 545 550 fprintf(stderr, "%s:%d: error: %s", 546 551 prop->filename, prop->lineno, 547 - "choice value has a prompt outside its choice group\n"); 552 + "choice value must not have a prompt in another entry\n"); 548 553 ret = -1; 549 554 } 550 555 }