diff options
author | ndesaulniers@google.com <ndesaulniers@google.com> | 2023-08-01 15:22:17 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2023-08-02 10:23:36 -0700 |
commit | 79e8328e5acbe691bbde029a52c89d70dcbc22f3 (patch) | |
tree | 3abfe569415681d9d7438af4b93656abce9aedcf /scripts/spdxexclude | |
parent | 5d0c230f1de8c7515b6567d9afba1f196fb4e2f4 (diff) | |
download | linux-stable-79e8328e5acbe691bbde029a52c89d70dcbc22f3.tar.gz linux-stable-79e8328e5acbe691bbde029a52c89d70dcbc22f3.tar.bz2 linux-stable-79e8328e5acbe691bbde029a52c89d70dcbc22f3.zip |
word-at-a-time: use the same return type for has_zero regardless of endianness
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: 36126f8f2ed8 ("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>
Diffstat (limited to 'scripts/spdxexclude')
0 files changed, 0 insertions, 0 deletions