da0fec30a7
[ Upstream commit 77a92660d8fe8d29503fae768d9f5eb529c88b36 ] expr_trans_bool() performs an incorrect transformation. [Test Code] config MODULES def_bool y modules config A def_bool y select C if B != n config B def_tristate m config C tristate [Result] CONFIG_MODULES=y CONFIG_A=y CONFIG_B=m CONFIG_C=m This output is incorrect because CONFIG_C=y is expected. Documentation/kbuild/kconfig-language.rst clearly explains the function of the '!=' operator: If the values of both symbols are equal, it returns 'n', otherwise 'y'. Therefore, the statement: select C if B != n should be equivalent to: select C if y Or, more simply: select C Hence, the symbol C should be selected by the value of A, which is 'y'. However, expr_trans_bool() wrongly transforms it to: select C if B Therefore, the symbol C is selected by (A && B), which is 'm'. The comment block of expr_trans_bool() correctly explains its intention: * bool FOO!=n => FOO ^^^^ If FOO is bool, FOO!=n can be simplified into FOO. This is correct. However, the actual code performs this transformation when FOO is tristate: if (e->left.sym->type == S_TRISTATE) { ^^^^^^^^^^ While it can be fixed to S_BOOLEAN, there is no point in doing so because expr_tranform() already transforms FOO!=n to FOO when FOO is bool. (see the "case E_UNEQUAL" part) expr_trans_bool() is wrong and unnecessary. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Acked-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Sasha Levin <sashal@kernel.org> |
||
---|---|---|
.. | ||
atomic | ||
basic | ||
clang-tools | ||
coccinelle | ||
dtc | ||
dummy-tools | ||
gcc-plugins | ||
gdb | ||
genksyms | ||
kconfig | ||
ksymoops | ||
mod | ||
package | ||
selinux | ||
tracing | ||
.gitignore | ||
Kbuild.include | ||
Kconfig.include | ||
Lindent | ||
Makefile | ||
Makefile.asm-generic | ||
Makefile.build | ||
Makefile.clang | ||
Makefile.clean | ||
Makefile.compiler | ||
Makefile.dtbinst | ||
Makefile.extrawarn | ||
Makefile.gcc-plugins | ||
Makefile.headersinst | ||
Makefile.host | ||
Makefile.kasan | ||
Makefile.kcov | ||
Makefile.kcsan | ||
Makefile.lib | ||
Makefile.modfinal | ||
Makefile.modinst | ||
Makefile.modpost | ||
Makefile.package | ||
Makefile.ubsan | ||
Makefile.userprogs | ||
adjust_autoksyms.sh | ||
as-version.sh | ||
asn1_compiler.c | ||
bin2c.c | ||
bloat-o-meter | ||
bootgraph.pl | ||
bpf_doc.py | ||
cc-can-link.sh | ||
cc-version.sh | ||
check-sysctl-docs | ||
check_extable.sh | ||
checkdeclares.pl | ||
checkincludes.pl | ||
checkkconfigsymbols.py | ||
checkpatch.pl | ||
checkstack.pl | ||
checksyscalls.sh | ||
checkversion.pl | ||
cleanfile | ||
cleanpatch | ||
coccicheck | ||
config | ||
const_structs.checkpatch | ||
decode_stacktrace.sh | ||
decodecode | ||
depmod.sh | ||
dev-needs.sh | ||
diffconfig | ||
documentation-file-ref-check | ||
export_report.pl | ||
extract-cert.c | ||
extract-ikconfig | ||
extract-module-sig.pl | ||
extract-sys-certs.pl | ||
extract-vmlinux | ||
extract_xc3028.pl | ||
faddr2line | ||
file-size.sh | ||
find-unused-docs.sh | ||
gcc-goto.sh | ||
gcc-ld | ||
gcc-x86_32-has-stack-protector.sh | ||
gcc-x86_64-has-stack-protector.sh | ||
gen_autoksyms.sh | ||
gen_ksymdeps.sh | ||
generate_initcall_order.pl | ||
get_abi.pl | ||
get_dvb_firmware | ||
get_feat.pl | ||
get_maintainer.pl | ||
gfp-translate | ||
headerdep.pl | ||
headers_check.pl | ||
headers_install.sh | ||
insert-sys-cert.c | ||
jobserver-exec | ||
kallsyms.c | ||
kernel-doc | ||
ld-version.sh | ||
leaking_addresses.pl | ||
link-vmlinux.sh | ||
makelst | ||
markup_oops.pl | ||
min-tool-version.sh | ||
mkcompile_h | ||
mksysmap | ||
mkuboot.sh | ||
module.lds.S | ||
modules-check.sh | ||
nsdeps | ||
objdiff | ||
pahole-flags.sh | ||
pahole-version.sh | ||
parse-maintainers.pl | ||
patch-kernel | ||
profile2linkerlist.pl | ||
prune-kernel | ||
recordmcount.c | ||
recordmcount.h | ||
recordmcount.pl | ||
remove-stale-files | ||
setlocalversion | ||
show_delta | ||
sign-file.c | ||
sorttable.c | ||
sorttable.h | ||
spdxcheck-test.sh | ||
spdxcheck.py | ||
spelling.txt | ||
sphinx-pre-install | ||
split-man.pl | ||
stackdelta | ||
stackusage | ||
subarch.include | ||
syscallhdr.sh | ||
syscallnr.sh | ||
syscalltbl.sh | ||
tags.sh | ||
tools-support-relr.sh | ||
unifdef.c | ||
ver_linux | ||
xen-hypercalls.sh | ||
xz_wrap.sh |