From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Dirk Gouders <dirk@gouders.net>
Cc: linux-kbuild@vger.kernel.org, Jan Beulich <jbeulich@suse.com>
Subject: Re: [PATCH] kconfig/menu.c: fix multiple references to expressions in menu_add_prop()
Date: Thu, 23 May 2013 10:28:23 +0200 [thread overview]
Message-ID: <20130523082823.GF3373@free.fr> (raw)
In-Reply-To: <1369126451-11930-1-git-send-email-dirk@gouders.net>
Dirk, All,
On 2013-05-21 10:54 +0200, Dirk Gouders spake thusly:
> menu_add_prop() applies upper menus' visibilities to actual prompts
> by AND-ing the prompts visibilities with the upper menus ones.
[--SNIP--]
> This patch fixes this problem by creating copies of the menu's
> visibility expressions before AND-ing them with the prompt's one.
>
> Signed-off-by: Dirk Gouders <dirk@gouders.net>
> ---
> scripts/kconfig/menu.c | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
> index b5c7d90..567939c 100644
> --- a/scripts/kconfig/menu.c
> +++ b/scripts/kconfig/menu.c
> @@ -143,14 +143,25 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e
>
> /* Apply all upper menus' visibilities to actual prompts. */
> if(type == P_PROMPT) {
> + struct expr *dup_expr;
I'd rather this variable defined below:
> struct menu *menu = current_entry;
>
> while ((menu = menu->parent) != NULL) {
... here, in the block where it is used, since it is not relevant
outside this block.
> if (!menu->visibility)
> continue;
> + /*
> + * Do not add a reference to the
> + * menu's visibility expression but
> + * use a copy of it. Otherwise the
> + * expression reduction functions
> + * will modify expressions that have
> + * multiple references which can
> + * cause unwanted side-effects.
> + */
> + dup_expr = expr_copy(menu->visibility);
I wonder if/where this should be de-allocated.
> +
> prop->visible.expr
> - = expr_alloc_and(prop->visible.expr,
> - menu->visibility);
> + = expr_alloc_and(prop->visible.expr, dup_expr);
> }
> }
>
I'm testing it right now. Thanks!
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
next prev parent reply other threads:[~2013-05-23 8:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-21 8:54 [PATCH] kconfig/menu.c: fix multiple references to expressions in menu_add_prop() Dirk Gouders
2013-05-21 12:36 ` Dirk Gouders
2013-05-23 8:28 ` Yann E. MORIN [this message]
2013-05-23 10:25 ` Dirk Gouders
2013-05-29 21:58 ` Yann E. MORIN
2013-05-30 3:59 ` Dirk Gouders
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=20130523082823.GF3373@free.fr \
--to=yann.morin.1998@free.fr \
--cc=dirk@gouders.net \
--cc=jbeulich@suse.com \
--cc=linux-kbuild@vger.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.