kconfig: forbid multiple entries with the same symbol in a choice
Commit6a859f1a19("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 commit4d46b5b623("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>
This commit is contained in:
parent
2fb62d9154
commit
d13a089d82
1 changed files with 4 additions and 11 deletions
|
|
@ -159,14 +159,8 @@ config_stmt: config_entry_start config_option_list
|
|||
yynerrs++;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the same symbol appears twice in a choice block, the list
|
||||
* node would be added twice, leading to a broken linked list.
|
||||
* list_empty() ensures that this symbol has not yet added.
|
||||
*/
|
||||
if (list_empty(¤t_entry->sym->choice_link))
|
||||
list_add_tail(¤t_entry->sym->choice_link,
|
||||
¤t_choice->choice_members);
|
||||
list_add_tail(¤t_entry->sym->choice_link,
|
||||
¤t_choice->choice_members);
|
||||
}
|
||||
|
||||
printd(DEBUG_PARSE, "%s:%d:endconfig\n", cur_filename, cur_lineno);
|
||||
|
|
@ -546,11 +540,10 @@ static int choice_check_sanity(const struct menu *menu)
|
|||
ret = -1;
|
||||
}
|
||||
|
||||
if (prop->menu != menu && prop->type == P_PROMPT &&
|
||||
prop->menu->parent != menu->parent) {
|
||||
if (prop->menu != menu && prop->type == P_PROMPT) {
|
||||
fprintf(stderr, "%s:%d: error: %s",
|
||||
prop->filename, prop->lineno,
|
||||
"choice value has a prompt outside its choice group\n");
|
||||
"choice value must not have a prompt in another entry\n");
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue