Go to file
Masahiro Yamada da0fec30a7 kconfig: remove wrong expr_trans_bool()
[ Upstream commit 77a92660d8 ]

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>
2024-07-27 10:46:09 +02:00
arch arm64: armv8_deprecated: Fix warning in isndep cpuhp starting process 2024-07-27 10:46:09 +02:00
block block/ioctl: prefer different overflow check 2024-07-05 09:14:25 +02:00
certs
crypto crypto: aead,cipher - zeroize key buffer after use 2024-07-18 13:07:27 +02:00
Documentation dt-bindings: i2c: google,cros-ec-i2c-tunnel: correct path to i2c-controller schema 2024-07-05 09:14:35 +02:00
drivers null_blk: fix validation of block size 2024-07-27 10:46:09 +02:00
fs filelock: Remove locks reliably when fcntl/close race is detected 2024-07-27 10:46:06 +02:00
include scsi: core: Fix a use-after-free 2024-07-27 10:46:07 +02:00
init init/main.c: Fix potential static_command_line memory overflow 2024-04-27 17:05:28 +02:00
io_uring io_uring: fail NOP if non-zero op flags is passed in 2024-06-16 13:39:53 +02:00
ipc
kernel bpf: Fix overrunning reservations in ringbuf 2024-07-27 10:46:06 +02:00
lib kunit: Fix timeout message 2024-07-18 13:07:29 +02:00
LICENSES
mm Revert "mm/writeback: fix possible divide-by-zero in wb_dirty_limits(), again" 2024-07-18 13:07:33 +02:00
net ila: block BH in ila_output() 2024-07-27 10:46:09 +02:00
samples samples/hw_breakpoint: fix building without module unloading 2023-09-23 11:10:01 +02:00
scripts kconfig: remove wrong expr_trans_bool() 2024-07-27 10:46:09 +02:00
security ima: Avoid blocking in RCU read-side critical section 2024-07-18 13:07:34 +02:00
sound ALSA: hda/realtek: Limit mic boost on VAIO PRO PX 2024-07-18 13:07:42 +02:00
tools selftests/openat2: Fix build warnings on ppc64 2024-07-27 10:46:08 +02:00
usr
virt KVM: Always flush async #PF workqueue when vCPU is being destroyed 2024-04-10 16:18:34 +02:00
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS trace: Relocate event helper files 2024-04-10 16:19:24 +02:00
Makefile Linux 5.15.163 2024-07-18 13:07:45 +02:00
README

Linux kernel

There are several guides for kernel developers and users. These guides can be rendered in a number of formats, like HTML and PDF. Please read Documentation/admin-guide/README.rst first.

In order to build the documentation, use make htmldocs or make pdfdocs. The formatted documentation can also be read online at:

https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory, several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the requirements for building and running the kernel, and information about the problems which may result by upgrading your kernel.