android_kernel_xiaomi_sm8350/arch/mips
Nathan Chancellor 5d8244d42d MIPS: tlbex: Explicitly compare _PAGE_NO_EXEC against 0
[ Upstream commit 74de14fe05dd6b151d73cb0c73c8ec874cbdcde6 ]

When CONFIG_XPA is enabled, Clang warns:

  arch/mips/mm/tlbex.c:629:24: error: converting the result of '<<' to a boolean; did you mean '(1 << _PAGE_NO_EXEC_SHIFT) != 0'? [-Werror,-Wint-in-bool-context]
          if (cpu_has_rixi && !!_PAGE_NO_EXEC) {
                              ^
  arch/mips/include/asm/pgtable-bits.h:174:28: note: expanded from macro '_PAGE_NO_EXEC'
  # define _PAGE_NO_EXEC          (1 << _PAGE_NO_EXEC_SHIFT)
                                     ^
  arch/mips/mm/tlbex.c:2568:24: error: converting the result of '<<' to a boolean; did you mean '(1 << _PAGE_NO_EXEC_SHIFT) != 0'? [-Werror,-Wint-in-bool-context]
          if (!cpu_has_rixi || !_PAGE_NO_EXEC) {
                                ^
  arch/mips/include/asm/pgtable-bits.h:174:28: note: expanded from macro '_PAGE_NO_EXEC'
  # define _PAGE_NO_EXEC          (1 << _PAGE_NO_EXEC_SHIFT)
                                     ^
  2 errors generated.

_PAGE_NO_EXEC can be '0' or '1 << _PAGE_NO_EXEC_SHIFT' depending on the
build and runtime configuration, which is what the negation operators
are trying to convey. To silence the warning, explicitly compare against
0 so the result of the '<<' operator is not implicitly converted to a
boolean.

According to its documentation, GCC enables -Wint-in-bool-context with
-Wall but this warning is not visible when building the same
configuration with GCC. It appears GCC only warns when compiling C++,
not C, although the documentation makes no note of this:
https://godbolt.org/z/x39q3brxf

Reported-by: Sudip Mukherjee (Codethink) <sudipm.mukherjee@gmail.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-08-25 11:18:39 +02:00
..
alchemy
ar7
ath25
ath79
bcm47xx
bcm63xx mips: bcm63xx: add support for clk_set_parent() 2022-01-27 09:19:40 +01:00
bmips MIPS: Use address-of operator on section symbols 2022-05-15 19:54:46 +02:00
boot
cavium-octeon mips: cavium-octeon: Fix missing of_node_put() in octeon2_usb_clocks_start 2022-08-25 11:18:36 +02:00
cobalt
configs
crypto
dec mips: DEC: honor CONFIG_MIPS_FP_SUPPORT=n 2022-04-15 14:18:15 +02:00
emma
fw
generic MIPS: generic/yamon-dt: fix uninitialized variable error 2021-11-26 10:47:19 +01:00
include mips: use fallback for random_get_entropy() instead of just c0 random 2022-06-22 14:11:15 +02:00
jazz
jz4740 MIPS: fix build with gcc-12 2022-05-18 09:47:28 +02:00
kernel MIPS: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK 2022-08-25 11:17:26 +02:00
kvm
lantiq MIPS: lantiq: check the return value of kzalloc() 2022-05-25 09:14:32 +02:00
lasat
lib
loongson32
loongson64
math-emu
mm MIPS: tlbex: Explicitly compare _PAGE_NO_EXEC against 0 2022-08-25 11:18:39 +02:00
mti-malta
net bpf, mips: Validate conditional branch offsets 2021-10-13 10:08:17 +02:00
netlogic
oprofile
paravirt
pci
pic32 MIPS: Use address-of operator on section symbols 2022-05-15 19:54:46 +02:00
pistachio
pmcs-msp71xx
pnx833x
power
ralink MIPS: Use address-of operator on section symbols 2022-05-15 19:54:46 +02:00
rb532 MIPS: RB532: fix return value of __setup handler 2022-04-15 14:18:16 +02:00
sgi-ip22
sgi-ip27
sgi-ip32
sibyte
sni MIPS: sni: Fix the build 2021-11-26 10:47:16 +01:00
tools
txx9
vdso
vr41xx MIPS: Remove repetitive increase irq_err_count 2022-06-29 08:58:46 +02:00
Kbuild
Kbuild.platforms
Kconfig MIPS: use 3-level pgtable for 64KB page size on MIPS_VA_BITS_48 2021-12-01 09:23:33 +01:00
Kconfig.debug
Makefile
Makefile.postlink