From: Sam Ravnborg <sam@ravnborg.org>
To: Ulf Magnusson <ulfalizer@gmail.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>,
Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
Michal Marek <michal.lkml@markovi.net>,
Randy Dunlap <rdunlap@infradead.org>,
"Luis R. Rodriguez" <mcgrof@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kconfig: Don't leak choice names during parsing
Date: Tue, 20 Feb 2018 21:39:04 +0100 [thread overview]
Message-ID: <20180220203904.GA14220@ravnborg.org> (raw)
In-Reply-To: <CAFkk2KRbErqLGspp9Th9J+nGzJffxpmiZ81b6jqe-dNH9SJ3ig@mail.gmail.com>
On Tue, Feb 20, 2018 at 08:54:58PM +0100, Ulf Magnusson wrote:
> On Tue, Feb 20, 2018 at 12:40 PM, Masahiro Yamada
> <yamada.masahiro@socionext.com> wrote:
> > The named choice is not used in the kernel tree, but if it were used,
> > it would not be freed.
> >
> > The intention of the named choice can be seen in the log of
> > commit 5a1aa8a1aff6 ("kconfig: add named choice group").
> >
> > There is room for argument if this is useful in practice, but anyway
> > I am fixing the memory leak.
> >
> > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> > ---
> >
> > scripts/kconfig/zconf.y | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
> > index 4be9805..4893676 100644
> > --- a/scripts/kconfig/zconf.y
> > +++ b/scripts/kconfig/zconf.y
> > @@ -276,6 +276,7 @@ choice: T_CHOICE word_opt T_EOL
> > sym->flags |= SYMBOL_AUTO;
> > menu_add_entry(sym);
> > menu_add_expr(P_CHOICE, NULL, NULL);
> > + free($2);
> > printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
> > };
> >
> > --
> > 2.7.4
> >
>
> Reviewed-by: Ulf Magnusson <ulfalizer@gmail.com>
>
> Only place I've seen named choices in practice is in the esp-idf
> project. Not sure what they're using them for.
The plan with named choices was that it should
allow one to do something like this:
# in one file the choice was defined:
choice FOOBAR
prompt "foobar"
config SAMBAR
bool "bar"
endchoice
# and in another file the choice was extended:
choice FOOBAR
config SAMFOO
bool "foo"
endchoice
The user was then presented only with a single list of choices.
The idea was that this would allow better support for a base
configuration that could be extended in another file.
Think arch/Kconfig versus an arch specific Kconfig file.
But Roman nor I never got around to actually implement this.
Most likely because the need was not big enough.
Sam
next prev parent reply other threads:[~2018-02-20 20:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-20 11:40 [PATCH] kconfig: Don't leak choice names during parsing Masahiro Yamada
2018-02-20 19:54 ` Ulf Magnusson
2018-02-20 20:39 ` Sam Ravnborg [this message]
2018-02-24 15:12 ` Masahiro Yamada
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=20180220203904.GA14220@ravnborg.org \
--to=sam@ravnborg.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=michal.lkml@markovi.net \
--cc=rdunlap@infradead.org \
--cc=ulfalizer@gmail.com \
--cc=yamada.masahiro@socionext.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox