linux/arch
Nathan Chancellor a050bbba5e MIPS: tlbex: Explicitly compare _PAGE_NO_EXEC against 0
[ Upstream commit 74de14fe05 ]

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>
History 2022-08-25 11:45:53 +02:00
..
alpha Cleanups (and one fix) around struct mount handling. 2022-06-04 19:00:05 -07:00
arc This set of changes updates init and user mode helper tasks to be 2022-06-03 16:03:05 -07:00
arm ARM: Marvell: Update PCIe fixup 2022-08-17 15:16:09 +02:00
arm64 KVM: arm64: Reject 32bit user PSTATE on asymmetric systems 2022-08-25 11:45:38 +02:00
csky csky/kprobe: reclaim insn_slot on kprobe unregistration 2022-08-25 11:45:46 +02:00
hexagon fork: Generalize PF_IO_WORKER handling 2022-05-07 09:01:59 -05:00
ia64 ia64, processor: fix -Wincompatible-pointer-types in ia64_get_irr() 2022-08-17 15:13:56 +02:00
loongarch LoongArch: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK 2022-08-17 15:13:46 +02:00
m68k m68k: coldfire/device.c: protect FLEXCAN blocks 2022-08-25 11:45:15 +02:00
microblaze This set of changes updates init and user mode helper tasks to be 2022-06-03 16:03:05 -07:00
mips MIPS: tlbex: Explicitly compare _PAGE_NO_EXEC against 0 2022-08-25 11:45:53 +02:00
nios2 nios2: add force_successful_syscall_return() 2022-08-25 11:45:27 +02:00
openrisc openrisc: io: Define iounmap argument as volatile 2022-08-25 11:45:46 +02:00
parisc parisc: io_pgetevents_time64() needs compat syscall in 32-bit compat mode 2022-08-17 15:13:48 +02:00
powerpc powerpc/64: Init jump labels before parse_early_param() 2022-08-25 11:45:53 +02:00
riscv RISC-V: Add fast call path of crash_kexec() 2022-08-25 11:45:50 +02:00
s390 Revert "s390/smp: enforce lowcore protection on CPU restart" 2022-08-17 15:16:20 +02:00
sh sh: convert nommu io{re,un}map() to static inline functions 2022-07-03 15:42:32 -07:00
sparc mmu_gather: Remove per arch tlb_{start,end}_vma() 2022-07-21 10:50:13 -07:00
um um: add "noreboot" command line option for PANIC_TIMEOUT=-1 setups 2022-08-25 11:45:45 +02:00
x86 x86/kvm: Fix "missing ENDBR" BUG for fastop functions 2022-08-25 11:45:39 +02:00
xtensa xtensa: iss: fix handling error cases in iss_net_configure() 2022-08-17 15:15:32 +02:00
.gitignore .gitignore: prefix local generated files with a slash 2021-05-02 00:43:35 +09:00
Kconfig arch: make TRACE_IRQFLAGS_NMI_SUPPORT generic 2022-08-17 15:13:59 +02:00