From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: linux-kbuild@vger.kernel.org
Cc: Ulf Magnusson <ulfalizer@gmail.com>,
Randy Dunlap <rdunlap@infradead.org>,
Taehee Yoo <ap420073@gmail.com>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] kconfig: fix reverse dependency with tristate if-conditional
Date: Mon, 26 Nov 2018 16:22:48 +0900 [thread overview]
Message-ID: <1543216969-2227-1-git-send-email-yamada.masahiro@socionext.com> (raw)
A Kconfig property can have an optional if-expression, which describes
its visibility. The property is visible when the if-expression part is
evaluated to 'y' or 'm'.
The 'select' and 'imply' properties are internally converted to reverse
dependencies, but they are wrongly converted if they have a tristate
if-expression.
Example:
config A
tristate "a"
config B
tristate "b"
select A if C
config C
tristate "c"
Currently, the reverse dependency of 'A' results in 'B && C'.
It is incorrect because the combination of B=y and C=m allows
'A' to become 'm', while its lower limit must be 'y'.
The reverse dependency should be 'B && C != n'.
Randy Dunlap reported that people are trying to fix an individual
Kconfig file [1], and I also found another example in the past,
commit 9d9c98e89ee2 ("pcmcia: fix yenta dependency on PCCARD_NONSTATIC")
but I suspect this is a bug of Kconfig itself.
[1] https://www.spinics.net/lists/netfilter-devel/msg56985.html
Reported-by: Taehee Yoo <ap420073@gmail.com>
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
| 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 4cf15d4..2b18833 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -401,11 +401,13 @@ void menu_finalize(struct menu *parent)
if (prop->type == P_SELECT) {
struct symbol *es = prop_get_symbol(prop);
es->rev_dep.expr = expr_alloc_or(es->rev_dep.expr,
- expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep)));
+ expr_alloc_and(expr_alloc_symbol(menu->sym),
+ expr_trans_compare(dep, E_UNEQUAL, &symbol_no)));
} else if (prop->type == P_IMPLY) {
struct symbol *es = prop_get_symbol(prop);
es->implied.expr = expr_alloc_or(es->implied.expr,
- expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep)));
+ expr_alloc_and(expr_alloc_symbol(menu->sym),
+ expr_trans_compare(dep, E_UNEQUAL, &symbol_no)));
}
}
}
--
2.7.4
next reply other threads:[~2018-11-26 7:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-26 7:22 Masahiro Yamada [this message]
2018-11-26 7:22 ` [PATCH 2/2] kconfig: tests: test reverse dependency with tristate if-conditional Masahiro Yamada
2018-11-27 1:09 ` kbuild test robot
2018-11-26 8:15 ` [PATCH 1/2] kconfig: fix " kbuild test robot
2018-11-26 9:05 ` Masahiro Yamada
2018-11-26 8:37 ` kbuild test robot
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=1543216969-2227-1-git-send-email-yamada.masahiro@socionext.com \
--to=yamada.masahiro@socionext.com \
--cc=ap420073@gmail.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@infradead.org \
--cc=ulfalizer@gmail.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;
as well as URLs for NNTP newsgroup(s).