android_kernel_motorola_sm6375/arch
Repository files (latest commit first)
Filename Latest commit message Latest commit date
ndesaulniers@google.com d2fb096926 word-at-a-time: use the same return type for has_zero regardless of endianness
[ Upstream commit 79e8328e5acbe691bbde029a52c89d70dcbc22f3 ]

Compiling big-endian targets with Clang produces the diagnostic:

  fs/namei.c:2173:13: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
	} while (!(has_zero(a, &adata, &constants) | has_zero(b, &bdata, &constants)));
	          ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                               ||
  fs/namei.c:2173:13: note: cast one or both operands to int to silence this warning

It appears that when has_zero was introduced, two definitions were
produced with different signatures (in particular different return
types).

Looking at the usage in hash_name() in fs/namei.c, I suspect that
has_zero() is meant to be invoked twice per while loop iteration; using
logical-or would not update `bdata` when `a` did not have zeros.  So I
think it's preferred to always return an unsigned long rather than a
bool than update the while loop in hash_name() to use a logical-or
rather than bitwise-or.

[ Also changed powerpc version to do the same  - Linus ]

Link: https://github.com/ClangBuiltLinux/linux/issues/1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8f2e ("word-at-a-time: make the interfaces truly generic")
Debugged-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-08-11 11:53:54 +02:00
..
alpha init: Remove check_bugs() leftovers 2023-08-08 19:56:34 +02:00
arc ARC: define ASM_NL and __ALIGN(_STR) outside #ifdef __ASSEMBLY__ guard 2023-07-27 08:37:18 +02:00
arm ARM: cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:56:33 +02:00
arm64 arm64: Fix bit-shifting UB in the MIDR_CPU_MODEL() macro 2023-08-11 11:53:54 +02:00
c6x
csky
h8300
hexagon
ia64 ia64/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:56:34 +02:00
m68k m68k/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:56:34 +02:00
microblaze
mips mips/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:56:34 +02:00
nds32
nios2
openrisc
parisc init: Remove check_bugs() leftovers 2023-08-08 19:56:34 +02:00
powerpc word-at-a-time: use the same return type for has_zero regardless of endianness 2023-08-11 11:53:54 +02:00
riscv
s390 KVM: s390: vsie: fix the length of APCB bitmap 2023-07-27 08:37:22 +02:00
sh sh/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:56:34 +02:00
sparc sparc/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:56:34 +02:00
um um/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:56:34 +02:00
unicore32
x86 x86: fix backwards merge of GDS/SRSO bit 2023-08-08 19:56:37 +02:00
xtensa init: Remove check_bugs() leftovers 2023-08-08 19:56:34 +02:00
.gitignore
Kconfig init: Provide arch_cpu_finalize_init() 2023-08-08 19:56:33 +02:00