From: Nathan Chancellor <nathan@kernel.org>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: linux-kbuild@vger.kernel.org, Nicolas Schier <nsc@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kconfig: forbid multiple entries with the same symbol in a choice
Date: Mon, 30 Mar 2026 16:14:17 +0200 [thread overview]
Message-ID: <20260330141417.GA1990358@ax162> (raw)
In-Reply-To: <20260330115736.1559962-1-masahiroy@kernel.org>
On Mon, Mar 30, 2026 at 08:57:35PM +0900, Masahiro Yamada wrote:
> 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>
Yeah, definitely seems like a reasonable restriction.
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> ---
>
> scripts/kconfig/parser.y | 15 ++++-----------
> 1 file changed, 4 insertions(+), 11 deletions(-)
>
> diff --git a/scripts/kconfig/parser.y b/scripts/kconfig/parser.y
> index 6d1bbee38f5d..5fb6f07b6ad2 100644
> --- a/scripts/kconfig/parser.y
> +++ b/scripts/kconfig/parser.y
> @@ -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;
> }
> }
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-03-30 14:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-30 11:57 [PATCH] kconfig: forbid multiple entries with the same symbol in a choice Masahiro Yamada
2026-03-30 14:14 ` Nathan Chancellor [this message]
2026-04-03 19:15 ` Nicolas Schier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260330141417.GA1990358@ax162 \
--to=nathan@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=nsc@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.