Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Wbitwise-instead-of-logical in fs/namei.c #1832

Closed
nickdesaulniers opened this issue Apr 11, 2023 · 6 comments
Closed

-Wbitwise-instead-of-logical in fs/namei.c #1832

nickdesaulniers opened this issue Apr 11, 2023 · 6 comments
Assignees
Labels
-Wbitwise-instead-of-logical [ARCH] arm64 This bug impacts ARCH=arm64 [BUG] linux A bug that should be fixed in the mainline kernel. [FIXED][LINUX] 6.5 This bug was fixed in Linux 6.5

Comments

@nickdesaulniers
Copy link
Member

https://github.com/ClangBuiltLinux/continuous-integration2/actions/runs/4667394776/jobs/8267646356#step:5:2173

Warning: /builds/linux/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)));
                  ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                   ||
/builds/linux/fs/namei.c:2173:13: note: cast one or both operands to int to silence this warning

looks like an arm64 big endian build of mainline.

@nickdesaulniers nickdesaulniers added [BUG] linux A bug that should be fixed in the mainline kernel. [ARCH] arm64 This bug impacts ARCH=arm64 -Wbitwise-instead-of-logical labels Apr 11, 2023
@nathanchance
Copy link
Member

Huh, I thought we had an existing issue around this but I guess not :) I looked into this a while ago but never wrote anything down. has_zero() returns a boolean for big endian builds but it returns unsigned long for little endian builds (https://git.kernel.org/linus/36126f8f2ed8168eb13aa0662b9b9585cba100a9, https://git.kernel.org/linus/a6e2f029ae34f41adb6ae3812c32c5d326e1abd2). I suspect the cast would make people unhappy and I was not clear to me why there is this discrepancy around return types.

@nickdesaulniers
Copy link
Member Author

has_zero() returns a boolean for big endian builds

Sounds like that should be changed to return an unsigned long 0UL rather than false.

@nathanchance
Copy link
Member

This is the current return statement, it is not a simple constant: https://elixir.bootlin.com/linux/v6.3-rc6/source/include/asm-generic/word-at-a-time.h#L45. has_zero() is always used within a boolean context though so changing the return type should not matter for all current use cases but it could matter in other contexts?

@nickdesaulniers
Copy link
Member Author

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=36126f8f2ed8168eb13aa0662b9b9585cba100a9 has uses of has_zero with bitwise operations, which would imply non-boolean context usage. If that usage persists, then it looks like bool is incorrect.

intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Aug 1, 2023
…ndianness

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 then update the while loop in hash_name() to use a logical-or
rather than bitwise-or.

Link: ClangBuiltLinux#1832
Fixes: 36126f8 ("word-at-a-time: make the interfaces truly generic")
Debugged-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
@nickdesaulniers
Copy link
Member Author

@nickdesaulniers nickdesaulniers added the [PATCH] Submitted A patch has been submitted for review label Aug 1, 2023
@nickdesaulniers nickdesaulniers self-assigned this Aug 1, 2023
torvalds pushed a commit to torvalds/linux that referenced this issue Aug 2, 2023
…ndianness

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: ClangBuiltLinux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
@nathanchance
Copy link
Member

@nathanchance nathanchance added [FIXED][LINUX] 6.5 This bug was fixed in Linux 6.5 and removed [PATCH] Submitted A patch has been submitted for review labels Aug 2, 2023
mj22226 pushed a commit to mj22226/linux that referenced this issue Aug 7, 2023
…ndianness

[ Upstream commit 79e8328 ]

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: ClangBuiltLinux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
Kaz205 pushed a commit to Kaz205/linux that referenced this issue Aug 8, 2023
…ndianness

[ Upstream commit 79e8328 ]

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: ClangBuiltLinux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
joelagnel pushed a commit to joelagnel/linux-kernel that referenced this issue Aug 9, 2023
…ndianness

[ Upstream commit 79e8328 ]

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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
mj22226 pushed a commit to mj22226/linux that referenced this issue Aug 9, 2023
…ndianness

[ Upstream commit 79e8328 ]

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: ClangBuiltLinux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
fiqri19102002 pushed a commit to fiqri19102002/android_kernel_xiaomi_sweet that referenced this issue Aug 9, 2023
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
mizdrake7 pushed a commit to mizdrake7/Graveyard_r5x that referenced this issue Aug 9, 2023
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
mizdrake7 pushed a commit to mizdrake7/Graveyard_r5x that referenced this issue Aug 9, 2023
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
fiqri19102002 pushed a commit to fiqri19102002/android_kernel_xiaomi_sweet that referenced this issue Aug 9, 2023
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
bananafunction pushed a commit to bananafunction/android_kernel_oneplus_sdm845 that referenced this issue Aug 9, 2023
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
mj22226 pushed a commit to mj22226/linux that referenced this issue Aug 9, 2023
…ndianness

[ Upstream commit 79e8328 ]

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: ClangBuiltLinux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
bananafunction pushed a commit to bananafunction/android_kernel_oneplus_sdm845 that referenced this issue Aug 9, 2023
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
TogoFire pushed a commit to Dev-msm8953/kernel_xiaomi_msm8953 that referenced this issue Aug 10, 2023
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("word-at-a-time: make the interfaces truly generic")
Debugged-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Change-Id: Idf57c762c881ff915d2392ea716d059e8a61ff28
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>
(cherry picked from commit 2b9f56f)
Signed-off-by: TogoFire <togofire@mailfence.com>
Kaz205 pushed a commit to Kaz205/linux that referenced this issue Aug 10, 2023
…ndianness

[ Upstream commit 79e8328 ]

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: ClangBuiltLinux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
Whissi pushed a commit to Whissi/linux-stable that referenced this issue Aug 11, 2023
…ndianness

[ Upstream commit 79e8328 ]

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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
Tomoms pushed a commit to Tomoms/android_kernel_essential_msm8998 that referenced this issue Oct 10, 2023
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
Signed-off-by: Ulrich Hecht <uli@kernel.org>
sileshn pushed a commit to sileshn/ubuntu-kernel-lunar that referenced this issue Oct 16, 2023
…ndianness

BugLink: https://bugs.launchpad.net/bugs/2038236

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
neel0210 pushed a commit to neel0210/android_kernel_realme_sm7125 that referenced this issue Oct 29, 2023
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
AbzRaider pushed a commit to AbzRaider/android_kernel_oplus_realme7 that referenced this issue Oct 31, 2023
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
sileshn pushed a commit to sileshn/ubuntu-kernel-lunar that referenced this issue Nov 20, 2023
…ndianness

BugLink: https://bugs.launchpad.net/bugs/2038236

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
zahid5656 pushed a commit to zahid5656/android_kernel_realme_sm8150 that referenced this issue Nov 20, 2023
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
Arafattex45558 pushed a commit to Arafattex45558/android_kernel_xiaomi_mt6768 that referenced this issue Nov 23, 2023
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
bggRGjQaUbCoE pushed a commit to bggRGjQaUbCoE/android_kernel_samsung_sm8250 that referenced this issue Nov 27, 2023
…ndianness

[ 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: ClangBuiltLinux/linux#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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
LeCmnGend added a commit to LeCmnGend/kernel_xiaomi_raphael that referenced this issue Dec 13, 2023
Squashed commit of the following:

commit 1fbf59a86f2e86f257858394eac5ba767561d4fc
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Fri Aug 11 11:33:57 2023 +0200

    Linux 4.14.322

    Link: https://lore.kernel.org/r/20230809103642.552405807@linuxfoundation.org
    Tested-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b1a4b802010ae35769bb6399f33e534d3c819b5c
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Thu Dec 17 09:27:57 2020 -0800

    drm/edid: fix objtool warning in drm_cvt_modes()

    commit d652d5f1eeeb06046009f4fcb9b4542249526916 upstream.

    Commit 991fcb77f490 ("drm/edid: Fix uninitialized variable in
    drm_cvt_modes()") just replaced one warning with another.

    The original warning about a possibly uninitialized variable was due to
    the compiler not being smart enough to see that the case statement
    actually enumerated all possible cases.  And the initial fix was just to
    add a "default" case that had a single "unreachable()", just to tell the
    compiler that that situation cannot happen.

    However, that doesn't actually fix the fundamental reason for the
    problem: the compiler still doesn't see that the existing case
    statements enumerate all possibilities, so the compiler will still
    generate code to jump to that unreachable case statement.  It just won't
    complain about an uninitialized variable any more.

    So now the compiler generates code to our inline asm marker that we told
    it would not fall through, and end end result is basically random.  We
    have created a bridge to nowhere.

    And then, depending on the random details of just exactly what the
    compiler ends up doing, 'objtool' might end up complaining about the
    conditional branches (for conditions that cannot happen, and that thus
    will never be taken - but if the compiler was not smart enough to figure
    that out, we can't expect objtool to do so) going off in the weeds.

    So depending on how the compiler has laid out the result, you might see
    something like this:

        drivers/gpu/drm/drm_edid.o: warning: objtool: do_cvt_mode() falls through to next function drm_mode_detailed.isra.0()

    and now you have a truly inscrutable warning that makes no sense at all
    unless you start looking at whatever random code the compiler happened
    to generate for our bare "unreachable()" statement.

    IOW, don't use "unreachable()" unless you have an _active_ operation
    that generates code that actually makes it obvious that something is not
    reachable (ie an UD instruction or similar).

    Solve the "compiler isn't smart enough" problem by just marking one of
    the cases as "default", so that even when the compiler doesn't otherwise
    see that we've enumerated all cases, the compiler will feel happy and
    safe about there always being a valid case that initializes the 'width'
    variable.

    This also generates better code, since now the compiler doesn't generate
    comparisons for five different possibilities (the four real ones and the
    one that can't happen), but just for the three real ones and "the rest"
    (which is that last one).

    A smart enough compiler that sees that we cover all the cases won't care.

    Cc: Lyude Paul <lyude@redhat.com>
    Cc: Ilia Mirkin <imirkin@alum.mit.edu>
    Cc: Josh Poimboeuf <jpoimboe@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b1de222a66d9b9a98d0d0d35dc5851559f8777db
Author: Roger Quadros <rogerq@kernel.org>
Date:   Sun Jun 25 00:10:21 2023 +0530

    mtd: rawnand: omap_elm: Fix incorrect type in assignment

    [ Upstream commit d8403b9eeee66d5dd81ecb9445800b108c267ce3 ]

    Once the ECC word endianness is converted to BE32, we force cast it
    to u32 so we can use elm_write_reg() which in turn uses writel().

    Fixes below sparse warnings:

       drivers/mtd/nand/raw/omap_elm.c:180:37: sparse:     expected unsigned int [usertype] val
       drivers/mtd/nand/raw/omap_elm.c:180:37: sparse:     got restricted __be32 [usertype]
       drivers/mtd/nand/raw/omap_elm.c:185:37: sparse:     expected unsigned int [usertype] val
       drivers/mtd/nand/raw/omap_elm.c:185:37: sparse:     got restricted __be32 [usertype]
       drivers/mtd/nand/raw/omap_elm.c:190:37: sparse:     expected unsigned int [usertype] val
       drivers/mtd/nand/raw/omap_elm.c:190:37: sparse:     got restricted __be32 [usertype]
    >> drivers/mtd/nand/raw/omap_elm.c:200:40: sparse: sparse: restricted __be32 degrades to integer
       drivers/mtd/nand/raw/omap_elm.c:206:39: sparse: sparse: restricted __be32 degrades to integer
       drivers/mtd/nand/raw/omap_elm.c:210:37: sparse:     expected unsigned int [assigned] [usertype] val
       drivers/mtd/nand/raw/omap_elm.c:210:37: sparse:     got restricted __be32 [usertype]
       drivers/mtd/nand/raw/omap_elm.c:213:37: sparse:     expected unsigned int [assigned] [usertype] val
       drivers/mtd/nand/raw/omap_elm.c:213:37: sparse:     got restricted __be32 [usertype]
       drivers/mtd/nand/raw/omap_elm.c:216:37: sparse:     expected unsigned int [assigned] [usertype] val
       drivers/mtd/nand/raw/omap_elm.c:216:37: sparse:     got restricted __be32 [usertype]
       drivers/mtd/nand/raw/omap_elm.c:219:37: sparse:     expected unsigned int [assigned] [usertype] val
       drivers/mtd/nand/raw/omap_elm.c:219:37: sparse:     got restricted __be32 [usertype]
       drivers/mtd/nand/raw/omap_elm.c:222:37: sparse:     expected unsigned int [assigned] [usertype] val
       drivers/mtd/nand/raw/omap_elm.c:222:37: sparse:     got restricted __be32 [usertype]
       drivers/mtd/nand/raw/omap_elm.c:225:37: sparse:     expected unsigned int [assigned] [usertype] val
       drivers/mtd/nand/raw/omap_elm.c:225:37: sparse:     got restricted __be32 [usertype]
       drivers/mtd/nand/raw/omap_elm.c:228:39: sparse: sparse: restricted __be32 degrades to integer

    Fixes: bf22433575ef ("mtd: devices: elm: Add support for ELM error correction")
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202306212211.WDXokuWh-lkp@intel.com/
    Signed-off-by: Roger Quadros <rogerq@kernel.org>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/linux-mtd/20230624184021.7740-1-rogerq@kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 44c6025c16ddcd115f51b4f546105cee90965e42
Author: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
Date:   Tue May 9 10:47:47 2023 +0200

    test_firmware: fix a memory leak with reqs buffer

    commit be37bed754ed90b2655382f93f9724b3c1aae847 upstream.

    Dan Carpenter spotted that test_fw_config->reqs will be leaked if
    trigger_batched_requests_store() is called two or more times.
    The same appears with trigger_batched_requests_async_store().

    This bug wasn't trigger by the tests, but observed by Dan's visual
    inspection of the code.

    The recommended workaround was to return -EBUSY if test_fw_config->reqs
    is already allocated.

    Fixes: 7feebfa487b92 ("test_firmware: add support for request_firmware_into_buf")
    Cc: Luis Chamberlain <mcgrof@kernel.org>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Russ Weight <russell.h.weight@intel.com>
    Cc: Tianfei Zhang <tianfei.zhang@intel.com>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Colin Ian King <colin.i.king@gmail.com>
    Cc: Randy Dunlap <rdunlap@infradead.org>
    Cc: linux-kselftest@vger.kernel.org
    Cc: stable@vger.kernel.org # v5.4
    Suggested-by: Dan Carpenter <error27@gmail.com>
    Suggested-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
    Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
    Acked-by: Luis Chamberlain <mcgrof@kernel.org>
    Link: https://lore.kernel.org/r/20230509084746.48259-2-mirsad.todorovac@alu.unizg.hr
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a69df04fb5b1ead16ad90364e6691cf45126f92b
Author: Jan Kara <jack@suse.cz>
Date:   Tue Jun 13 12:25:52 2023 +0200

    ext2: Drop fragment support

    commit 404615d7f1dcd4cca200e9a7a9df3a1dcae1dd62 upstream.

    Ext2 has fields in superblock reserved for subblock allocation support.
    However that never landed. Drop the many years dead code.

    Reported-by: syzbot+af5e10f73dbff48f70af@syzkaller.appspotmail.com
    Signed-off-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f1c99fce87f11f6c7414da377470cbc3a9df4bb9
Author: Alan Stern <stern@rowland.harvard.edu>
Date:   Wed Jul 12 10:15:10 2023 -0400

    net: usbnet: Fix WARNING in usbnet_start_xmit/usb_submit_urb

    commit 5e1627cb43ddf1b24b92eb26f8d958a3f5676ccb upstream.

    The syzbot fuzzer identified a problem in the usbnet driver:

    usb 1-1: BOGUS urb xfer, pipe 3 != type 1
    WARNING: CPU: 0 PID: 754 at drivers/usb/core/urb.c:504 usb_submit_urb+0xed6/0x1880 drivers/usb/core/urb.c:504
    Modules linked in:
    CPU: 0 PID: 754 Comm: kworker/0:2 Not tainted 6.4.0-rc7-syzkaller-00014-g692b7dc87ca6 #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
    Workqueue: mld mld_ifc_work
    RIP: 0010:usb_submit_urb+0xed6/0x1880 drivers/usb/core/urb.c:504
    Code: 7c 24 18 e8 2c b4 5b fb 48 8b 7c 24 18 e8 42 07 f0 fe 41 89 d8 44 89 e1 4c 89 ea 48 89 c6 48 c7 c7 a0 c9 fc 8a e8 5a 6f 23 fb <0f> 0b e9 58 f8 ff ff e8 fe b3 5b fb 48 81 c5 c0 05 00 00 e9 84 f7
    RSP: 0018:ffffc9000463f568 EFLAGS: 00010086
    RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000000000
    RDX: ffff88801eb28000 RSI: ffffffff814c03b7 RDI: 0000000000000001
    RBP: ffff8881443b7190 R08: 0000000000000001 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000003
    R13: ffff88802a77cb18 R14: 0000000000000003 R15: ffff888018262500
    FS:  0000000000000000(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000556a99c15a18 CR3: 0000000028c71000 CR4: 0000000000350ef0
    Call Trace:
     <TASK>
     usbnet_start_xmit+0xfe5/0x2190 drivers/net/usb/usbnet.c:1453
     __netdev_start_xmit include/linux/netdevice.h:4918 [inline]
     netdev_start_xmit include/linux/netdevice.h:4932 [inline]
     xmit_one net/core/dev.c:3578 [inline]
     dev_hard_start_xmit+0x187/0x700 net/core/dev.c:3594
    ...

    This bug is caused by the fact that usbnet trusts the bulk endpoint
    addresses its probe routine receives in the driver_info structure, and
    it does not check to see that these endpoints actually exist and have
    the expected type and directions.

    The fix is simply to add such a check.

    Reported-and-tested-by: syzbot+63ee658b9a100ffadbe2@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/linux-usb/000000000000a56e9105d0cec021@google.com/
    Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
    CC: Oliver Neukum <oneukum@suse.com>
    Link: https://lore.kernel.org/r/ea152b6d-44df-4f8a-95c6-4db51143dcc1@rowland.harvard.edu
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f6fb3d1773695817bc2f94c9c96e1b0d891c47c3
Author: Sungwoo Kim <iam@sung-woo.kim>
Date:   Wed May 31 01:39:56 2023 -0400

    Bluetooth: L2CAP: Fix use-after-free in l2cap_sock_ready_cb

    commit 1728137b33c00d5a2b5110ed7aafb42e7c32e4a1 upstream.

    l2cap_sock_release(sk) frees sk. However, sk's children are still alive
    and point to the already free'd sk's address.
    To fix this, l2cap_sock_release(sk) also cleans sk's children.

    ==================================================================
    BUG: KASAN: use-after-free in l2cap_sock_ready_cb+0xb7/0x100 net/bluetooth/l2cap_sock.c:1650
    Read of size 8 at addr ffff888104617aa8 by task kworker/u3:0/276

    CPU: 0 PID: 276 Comm: kworker/u3:0 Not tainted 6.2.0-00001-gef397bd4d5fb-dirty #59
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
    Workqueue: hci2 hci_rx_work
    Call Trace:
     <TASK>
     __dump_stack lib/dump_stack.c:88 [inline]
     dump_stack_lvl+0x72/0x95 lib/dump_stack.c:106
     print_address_description mm/kasan/report.c:306 [inline]
     print_report+0x175/0x478 mm/kasan/report.c:417
     kasan_report+0xb1/0x130 mm/kasan/report.c:517
     l2cap_sock_ready_cb+0xb7/0x100 net/bluetooth/l2cap_sock.c:1650
     l2cap_chan_ready+0x10e/0x1e0 net/bluetooth/l2cap_core.c:1386
     l2cap_config_req+0x753/0x9f0 net/bluetooth/l2cap_core.c:4480
     l2cap_bredr_sig_cmd net/bluetooth/l2cap_core.c:5739 [inline]
     l2cap_sig_channel net/bluetooth/l2cap_core.c:6509 [inline]
     l2cap_recv_frame+0xe2e/0x43c0 net/bluetooth/l2cap_core.c:7788
     l2cap_recv_acldata+0x6ed/0x7e0 net/bluetooth/l2cap_core.c:8506
     hci_acldata_packet net/bluetooth/hci_core.c:3813 [inline]
     hci_rx_work+0x66e/0xbc0 net/bluetooth/hci_core.c:4048
     process_one_work+0x4ea/0x8e0 kernel/workqueue.c:2289
     worker_thread+0x364/0x8e0 kernel/workqueue.c:2436
     kthread+0x1b9/0x200 kernel/kthread.c:376
     ret_from_fork+0x2c/0x50 arch/x86/entry/entry_64.S:308
     </TASK>

    Allocated by task 288:
     kasan_save_stack+0x22/0x50 mm/kasan/common.c:45
     kasan_set_track+0x25/0x30 mm/kasan/common.c:52
     ____kasan_kmalloc mm/kasan/common.c:374 [inline]
     __kasan_kmalloc+0x82/0x90 mm/kasan/common.c:383
     kasan_kmalloc include/linux/kasan.h:211 [inline]
     __do_kmalloc_node mm/slab_common.c:968 [inline]
     __kmalloc+0x5a/0x140 mm/slab_common.c:981
     kmalloc include/linux/slab.h:584 [inline]
     sk_prot_alloc+0x113/0x1f0 net/core/sock.c:2040
     sk_alloc+0x36/0x3c0 net/core/sock.c:2093
     l2cap_sock_alloc.constprop.0+0x39/0x1c0 net/bluetooth/l2cap_sock.c:1852
     l2cap_sock_create+0x10d/0x220 net/bluetooth/l2cap_sock.c:1898
     bt_sock_create+0x183/0x290 net/bluetooth/af_bluetooth.c:132
     __sock_create+0x226/0x380 net/socket.c:1518
     sock_create net/socket.c:1569 [inline]
     __sys_socket_create net/socket.c:1606 [inline]
     __sys_socket_create net/socket.c:1591 [inline]
     __sys_socket+0x112/0x200 net/socket.c:1639
     __do_sys_socket net/socket.c:1652 [inline]
     __se_sys_socket net/socket.c:1650 [inline]
     __x64_sys_socket+0x40/0x50 net/socket.c:1650
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x3f/0x90 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x72/0xdc

    Freed by task 288:
     kasan_save_stack+0x22/0x50 mm/kasan/common.c:45
     kasan_set_track+0x25/0x30 mm/kasan/common.c:52
     kasan_save_free_info+0x2e/0x50 mm/kasan/generic.c:523
     ____kasan_slab_free mm/kasan/common.c:236 [inline]
     ____kasan_slab_free mm/kasan/common.c:200 [inline]
     __kasan_slab_free+0x10a/0x190 mm/kasan/common.c:244
     kasan_slab_free include/linux/kasan.h:177 [inline]
     slab_free_hook mm/slub.c:1781 [inline]
     slab_free_freelist_hook mm/slub.c:1807 [inline]
     slab_free mm/slub.c:3787 [inline]
     __kmem_cache_free+0x88/0x1f0 mm/slub.c:3800
     sk_prot_free net/core/sock.c:2076 [inline]
     __sk_destruct+0x347/0x430 net/core/sock.c:2168
     sk_destruct+0x9c/0xb0 net/core/sock.c:2183
     __sk_free+0x82/0x220 net/core/sock.c:2194
     sk_free+0x7c/0xa0 net/core/sock.c:2205
     sock_put include/net/sock.h:1991 [inline]
     l2cap_sock_kill+0x256/0x2b0 net/bluetooth/l2cap_sock.c:1257
     l2cap_sock_release+0x1a7/0x220 net/bluetooth/l2cap_sock.c:1428
     __sock_release+0x80/0x150 net/socket.c:650
     sock_close+0x19/0x30 net/socket.c:1368
     __fput+0x17a/0x5c0 fs/file_table.c:320
     task_work_run+0x132/0x1c0 kernel/task_work.c:179
     resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
     exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
     exit_to_user_mode_prepare+0x113/0x120 kernel/entry/common.c:203
     __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
     syscall_exit_to_user_mode+0x21/0x50 kernel/entry/common.c:296
     do_syscall_64+0x4c/0x90 arch/x86/entry/common.c:86
     entry_SYSCALL_64_after_hwframe+0x72/0xdc

    The buggy address belongs to the object at ffff888104617800
     which belongs to the cache kmalloc-1k of size 1024
    The buggy address is located 680 bytes inside of
     1024-byte region [ffff888104617800, ffff888104617c00)

    The buggy address belongs to the physical page:
    page:00000000dbca6a80 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888104614000 pfn:0x104614
    head:00000000dbca6a80 order:2 compound_mapcount:0 subpages_mapcount:0 compound_pincount:0
    flags: 0x200000000010200(slab|head|node=0|zone=2)
    raw: 0200000000010200 ffff888100041dc0 ffffea0004212c10 ffffea0004234b10
    raw: ffff888104614000 0000000000080002 00000001ffffffff 0000000000000000
    page dumped because: kasan: bad access detected

    Memory state around the buggy address:
     ffff888104617980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
     ffff888104617a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    >ffff888104617a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                      ^
     ffff888104617b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
     ffff888104617b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ==================================================================

    Ack: This bug is found by FuzzBT with a modified Syzkaller. Other
    contributors are Ruoyu Wu and Hui Peng.
    Signed-off-by: Sungwoo Kim <iam@sung-woo.kim>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d53821e461c5a9bfec1a20bb9d774ae38b64cfae
Author: Prince Kumar Maurya <princekumarmaurya06@gmail.com>
Date:   Tue May 30 18:31:41 2023 -0700

    fs/sysv: Null check to prevent null-ptr-deref bug

    commit ea2b62f305893992156a798f665847e0663c9f41 upstream.

    sb_getblk(inode->i_sb, parent) return a null ptr and taking lock on
    that leads to the null-ptr-deref bug.

    Reported-by: syzbot+aad58150cbc64ba41bdc@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=aad58150cbc64ba41bdc
    Signed-off-by: Prince Kumar Maurya <princekumarmaurya06@gmail.com>
    Message-Id: <20230531013141.19487-1-princekumarmaurya06@gmail.com>
    Signed-off-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 474c5421a2641b509b645bf0fee676f16b29525e
Author: Ross Maynard <bids.7405@bigpond.com>
Date:   Mon Jul 31 15:42:04 2023 +1000

    USB: zaurus: Add ID for A-300/B-500/C-700

    commit b99225b4fe297d07400f9e2332ecd7347b224f8d upstream.

    The SL-A300, B500/5600, and C700 devices no longer auto-load because of
    "usbnet: Remove over-broad module alias from zaurus."
    This patch adds IDs for those 3 devices.

    Link: https://bugzilla.kernel.org/show_bug.cgi?id=217632
    Fixes: 16adf5d07987 ("usbnet: Remove over-broad module alias from zaurus.")
    Signed-off-by: Ross Maynard <bids.7405@bigpond.com>
    Cc: stable@vger.kernel.org
    Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://lore.kernel.org/r/69b5423b-2013-9fc9-9569-58e707d9bafb@bigpond.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0ab43ef98a11099105f37e25536db06a6c440665
Author: Ilya Dryomov <idryomov@gmail.com>
Date:   Tue Aug 1 19:14:24 2023 +0200

    libceph: fix potential hang in ceph_osdc_notify()

    commit e6e2843230799230fc5deb8279728a7218b0d63c upstream.

    If the cluster becomes unavailable, ceph_osdc_notify() may hang even
    with osd_request_timeout option set because linger_notify_finish_wait()
    waits for MWatchNotify NOTIFY_COMPLETE message with no associated OSD
    request in flight -- it's completely asynchronous.

    Introduce an additional timeout, derived from the specified notify
    timeout.  While at it, switch both waits to killable which is more
    correct.

    Cc: stable@vger.kernel.org
    Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
    Reviewed-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
    Reviewed-by: Xiubo Li <xiubli@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 29f20bbfafe54d883d3731185a0f9cd21005e5e9
Author: Eric Dumazet <edumazet@google.com>
Date:   Wed Aug 2 13:15:00 2023 +0000

    tcp_metrics: fix data-race in tcpm_suck_dst() vs fastopen

    [ Upstream commit ddf251fa2bc1d3699eec0bae6ed0bc373b8fda79 ]

    Whenever tcpm_new() reclaims an old entry, tcpm_suck_dst()
    would overwrite data that could be read from tcp_fastopen_cache_get()
    or tcp_metrics_fill_info().

    We need to acquire fastopen_seqlock to maintain consistency.

    For newly allocated objects, tcpm_new() can switch to kzalloc()
    to avoid an extra fastopen_seqlock acquisition.

    Fixes: 1fe4c481ba63 ("net-tcp: Fast Open client - cookie cache")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Cc: Yuchung Cheng <ycheng@google.com>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Link: https://lore.kernel.org/r/20230802131500.1478140-7-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0b7bb9a54f4bc940526276ef9a28c653e780ffc4
Author: Eric Dumazet <edumazet@google.com>
Date:   Wed Aug 2 13:14:59 2023 +0000

    tcp_metrics: annotate data-races around tm->tcpm_net

    [ Upstream commit d5d986ce42c71a7562d32c4e21e026b0f87befec ]

    tm->tcpm_net can be read or written locklessly.

    Instead of changing write_pnet() and read_pnet() and potentially
    hurt performance, add the needed READ_ONCE()/WRITE_ONCE()
    in tm_net() and tcpm_new().

    Fixes: 849e8a0ca8d5 ("tcp_metrics: Add a field tcpm_net and verify it matches on lookup")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: David Ahern <dsahern@kernel.org>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Link: https://lore.kernel.org/r/20230802131500.1478140-6-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f52425de8b3f3e6f2e748bd8b71bf3abf74e5b7d
Author: Eric Dumazet <edumazet@google.com>
Date:   Wed Aug 2 13:14:58 2023 +0000

    tcp_metrics: annotate data-races around tm->tcpm_vals[]

    [ Upstream commit 8c4d04f6b443869d25e59822f7cec88d647028a9 ]

    tm->tcpm_vals[] values can be read or written locklessly.

    Add needed READ_ONCE()/WRITE_ONCE() to document this,
    and force use of tcp_metric_get() and tcp_metric_set()

    Fixes: 51c5d0c4b169 ("tcp: Maintain dynamic metrics in local cache.")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: David Ahern <dsahern@kernel.org>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 3e4c33e977faa18d74e84f565bf9812f1f6fa5d4
Author: Eric Dumazet <edumazet@google.com>
Date:   Wed Aug 2 13:14:57 2023 +0000

    tcp_metrics: annotate data-races around tm->tcpm_lock

    [ Upstream commit 285ce119a3c6c4502585936650143e54c8692788 ]

    tm->tcpm_lock can be read or written locklessly.

    Add needed READ_ONCE()/WRITE_ONCE() to document this.

    Fixes: 51c5d0c4b169 ("tcp: Maintain dynamic metrics in local cache.")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: David Ahern <dsahern@kernel.org>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Link: https://lore.kernel.org/r/20230802131500.1478140-4-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4a4cd13e43e31d183d28aae12fdd2fdbc8cf9693
Author: Eric Dumazet <edumazet@google.com>
Date:   Wed Aug 2 13:14:56 2023 +0000

    tcp_metrics: annotate data-races around tm->tcpm_stamp

    [ Upstream commit 949ad62a5d5311d36fce2e14fe5fed3f936da51c ]

    tm->tcpm_stamp can be read or written locklessly.

    Add needed READ_ONCE()/WRITE_ONCE() to document this.

    Also constify tcpm_check_stamp() dst argument.

    Fixes: 51c5d0c4b169 ("tcp: Maintain dynamic metrics in local cache.")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: David Ahern <dsahern@kernel.org>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Link: https://lore.kernel.org/r/20230802131500.1478140-3-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit db937645a1ecf86e9d61d4a0f9db164552834a2d
Author: Eric Dumazet <edumazet@google.com>
Date:   Wed Aug 2 13:14:55 2023 +0000

    tcp_metrics: fix addr_same() helper

    [ Upstream commit e6638094d7af6c7b9dcca05ad009e79e31b4f670 ]

    Because v4 and v6 families use separate inetpeer trees (respectively
    net->ipv4.peers and net->ipv6.peers), inetpeer_addr_cmp(a, b) assumes
    a & b share the same family.

    tcp_metrics use a common hash table, where entries can have different
    families.

    We must therefore make sure to not call inetpeer_addr_cmp()
    if the families do not match.

    Fixes: d39d14ffa24c ("net: Add helper function to compare inetpeer addresses")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: David Ahern <dsahern@kernel.org>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Link: https://lore.kernel.org/r/20230802131500.1478140-2-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0b3120b04a5a2995611734ddf94a5cf5f294190e
Author: Yue Haibing <yuehaibing@huawei.com>
Date:   Tue Aug 1 14:43:18 2023 +0800

    ip6mr: Fix skb_under_panic in ip6mr_cache_report()

    [ Upstream commit 30e0191b16e8a58e4620fa3e2839ddc7b9d4281c ]

    skbuff: skb_under_panic: text:ffffffff88771f69 len:56 put:-4
     head:ffff88805f86a800 data:ffff887f5f86a850 tail:0x88 end:0x2c0 dev:pim6reg
     ------------[ cut here ]------------
     kernel BUG at net/core/skbuff.c:192!
     invalid opcode: 0000 [#1] PREEMPT SMP KASAN
     CPU: 2 PID: 22968 Comm: kworker/2:11 Not tainted 6.5.0-rc3-00044-g0a8db05b571a #236
     Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
     Workqueue: ipv6_addrconf addrconf_dad_work
     RIP: 0010:skb_panic+0x152/0x1d0
     Call Trace:
      <TASK>
      skb_push+0xc4/0xe0
      ip6mr_cache_report+0xd69/0x19b0
      reg_vif_xmit+0x406/0x690
      dev_hard_start_xmit+0x17e/0x6e0
      __dev_queue_xmit+0x2d6a/0x3d20
      vlan_dev_hard_start_xmit+0x3ab/0x5c0
      dev_hard_start_xmit+0x17e/0x6e0
      __dev_queue_xmit+0x2d6a/0x3d20
      neigh_connected_output+0x3ed/0x570
      ip6_finish_output2+0x5b5/0x1950
      ip6_finish_output+0x693/0x11c0
      ip6_output+0x24b/0x880
      NF_HOOK.constprop.0+0xfd/0x530
      ndisc_send_skb+0x9db/0x1400
      ndisc_send_rs+0x12a/0x6c0
      addrconf_dad_completed+0x3c9/0xea0
      addrconf_dad_work+0x849/0x1420
      process_one_work+0xa22/0x16e0
      worker_thread+0x679/0x10c0
      ret_from_fork+0x28/0x60
      ret_from_fork_asm+0x11/0x20

    When setup a vlan device on dev pim6reg, DAD ns packet may sent on reg_vif_xmit().
    reg_vif_xmit()
        ip6mr_cache_report()
            skb_push(skb, -skb_network_offset(pkt));//skb_network_offset(pkt) is 4
    And skb_push declared as:
    	void *skb_push(struct sk_buff *skb, unsigned int len);
    		skb->data -= len;
    		//0xffff88805f86a84c - 0xfffffffc = 0xffff887f5f86a850
    skb->data is set to 0xffff887f5f86a850, which is invalid mem addr, lead to skb_push() fails.

    Fixes: 14fb64e1f449 ("[IPV6] MROUTE: Support PIM-SM (SSM).")
    Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 901f3793ff7202b6fafdbb6dec7a4ddd14925833
Author: valis <sec@valis.email>
Date:   Sat Jul 29 08:32:02 2023 -0400

    net/sched: cls_route: No longer copy tcf_result on update to avoid use-after-free

    [ Upstream commit b80b829e9e2c1b3f7aae34855e04d8f6ecaf13c8 ]

    When route4_change() is called on an existing filter, the whole
    tcf_result struct is always copied into the new instance of the filter.

    This causes a problem when updating a filter bound to a class,
    as tcf_unbind_filter() is always called on the old instance in the
    success path, decreasing filter_cnt of the still referenced class
    and allowing it to be deleted, leading to a use-after-free.

    Fix this by no longer copying the tcf_result struct from the old filter.

    Fixes: 1109c00547fc ("net: sched: RCU cls_route")
    Reported-by: valis <sec@valis.email>
    Reported-by: Bing-Jhong Billy Jheng <billy@starlabs.sg>
    Signed-off-by: valis <sec@valis.email>
    Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Reviewed-by: Victor Nogueira <victor@mojatatu.com>
    Reviewed-by: Pedro Tammela <pctammela@mojatatu.com>
    Reviewed-by: M A Ramdhan <ramdhan@starlabs.sg>
    Link: https://lore.kernel.org/r/20230729123202.72406-4-jhs@mojatatu.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit fe227cba4069d037e67b945138aa6b79dca02e5d
Author: valis <sec@valis.email>
Date:   Sat Jul 29 08:32:00 2023 -0400

    net/sched: cls_u32: No longer copy tcf_result on update to avoid use-after-free

    [ Upstream commit 3044b16e7c6fe5d24b1cdbcf1bd0a9d92d1ebd81 ]

    When u32_change() is called on an existing filter, the whole
    tcf_result struct is always copied into the new instance of the filter.

    This causes a problem when updating a filter bound to a class,
    as tcf_unbind_filter() is always called on the old instance in the
    success path, decreasing filter_cnt of the still referenced class
    and allowing it to be deleted, leading to a use-after-free.

    Fix this by no longer copying the tcf_result struct from the old filter.

    Fixes: de5df63228fc ("net: sched: cls_u32 changes to knode must appear atomic to readers")
    Reported-by: valis <sec@valis.email>
    Reported-by: M A Ramdhan <ramdhan@starlabs.sg>
    Signed-off-by: valis <sec@valis.email>
    Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Reviewed-by: Victor Nogueira <victor@mojatatu.com>
    Reviewed-by: Pedro Tammela <pctammela@mojatatu.com>
    Reviewed-by: M A Ramdhan <ramdhan@starlabs.sg>
    Link: https://lore.kernel.org/r/20230729123202.72406-2-jhs@mojatatu.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 96eedebb8572297a822dfbf9fa650fdccc1b1406
Author: Eric Dumazet <edumazet@google.com>
Date:   Fri Jul 28 15:03:17 2023 +0000

    net: add missing data-race annotation for sk_ll_usec

    [ Upstream commit e5f0d2dd3c2faa671711dac6d3ff3cef307bcfe3 ]

    In a prior commit I forgot that sk_getsockopt() reads
    sk->sk_ll_usec without holding a lock.

    Fixes: 0dbffbb5335a ("net: annotate data race around sk_ll_usec")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 043536daeccfd2d0d48b3eae3867af975682ee79
Author: Eric Dumazet <edumazet@google.com>
Date:   Fri Jul 28 15:03:16 2023 +0000

    net: add missing data-race annotations around sk->sk_peek_off

    [ Upstream commit 11695c6e966b0ec7ed1d16777d294cef865a5c91 ]

    sk_getsockopt() runs locklessly, thus we need to annotate the read
    of sk->sk_peek_off.

    While we are at it, add corresponding annotations to sk_set_peek_off()
    and unix_set_peek_off().

    Fixes: b9bb53f3836f ("sock: convert sk_peek_offset functions to WRITE_ONCE")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Cc: Willem de Bruijn <willemb@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 983f2ff7bc927620af5959e5db5d897c02c2e5ad
Author: Georg Müller <georgmueller@gmx.net>
Date:   Fri Jul 28 17:18:12 2023 +0200

    perf test uprobe_from_different_cu: Skip if there is no gcc

    [ Upstream commit 98ce8e4a9dcfb448b30a2d7a16190f4a00382377 ]

    Without gcc, the test will fail.

    On cleanup, ignore probe removal errors. Otherwise, in case of an error
    adding the probe, the temporary directory is not removed.

    Fixes: 56cbeacf14353057 ("perf probe: Add test for regression introduced by switch to die_get_decl_file()")
    Signed-off-by: Georg Müller <georgmueller@gmx.net>
    Acked-by: Ian Rogers <irogers@google.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Georg Müller <georgmueller@gmx.net>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: https://lore.kernel.org/r/20230728151812.454806-2-georgmueller@gmx.net
    Link: https://lore.kernel.org/r/CAP-5=fUP6UuLgRty3t2=fQsQi3k4hDMz415vWdp1x88QMvZ8ug@mail.gmail.com/
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 1af00726bd06dce6afad073901bd371d6cfde54f
Author: Yuanjun Gong <ruc_gongyuanjun@163.com>
Date:   Tue Jul 25 14:56:55 2023 +0800

    net/mlx5e: fix return value check in mlx5e_ipsec_remove_trailer()

    [ Upstream commit e5bcb7564d3bd0c88613c76963c5349be9c511c5 ]

    mlx5e_ipsec_remove_trailer() should return an error code if function
    pskb_trim() returns an unexpected value.

    Fixes: 2ac9cfe78223 ("net/mlx5e: IPSec, Add Innova IPSec offload TX data path")
    Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
    Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit da8453be4238f1f5d52ebe8c857651e3f3270439
Author: ndesaulniers@google.com <ndesaulniers@google.com>
Date:   Tue Aug 1 15:22:17 2023 -0700

    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: 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>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6f42a56a5db3cbb3ba10c5974b9c3b8fa0070b0b
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Wed Nov 16 22:40:17 2022 +0100

    perf: Fix function pointer case

    commit 1af6239d1d3e61d33fd2f0ba53d3d1a67cc50574 upstream.

    With the advent of CFI it is no longer acceptible to cast function
    pointers.

    The robot complains thusly:

      kernel-events-core.c:warning:cast-from-int-(-)(struct-perf_cpu_pmu_context-)-to-remote_function_f-(aka-int-(-)(void-)-)-converts-to-incompatible-function-type

    Reported-by: kernel test robot <lkp@intel.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Signed-off-by: Cixi Geng <cixi.geng1@unisoc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9fe0dbcfcaa3a1154e661ce98402d1136d504f56
Author: Lee Jones <lee@kernel.org>
Date:   Thu Jun 8 08:29:03 2023 +0100

    net/sched: cls_u32: Fix reference counter leak leading to overflow

    commit 04c55383fa5689357bcdd2c8036725a55ed632bc upstream.

    In the event of a failure in tcf_change_indev(), u32_set_parms() will
    immediately return without decrementing the recently incremented
    reference counter.  If this happens enough times, the counter will
    rollover and the reference freed, leading to a double free which can be
    used to do 'bad things'.

    In order to prevent this, move the point of possible failure above the
    point where the reference counter is incremented.  Also save any
    meaningful return values to be applied to the return data at the
    appropriate point in time.

    This issue was caught with KASAN.

    Fixes: 705c7091262d ("net: sched: cls_u32: no need to call tcf_exts_change for newly allocated struct")
    Suggested-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: Lee Jones <lee@kernel.org>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Rishabh Bhatnagar <risbhat@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9eca39b63e22ae4d726a1c3d2042ceb601533f3f
Author: Pedro Tammela <pctammela@mojatatu.com>
Date:   Tue Jul 11 18:01:02 2023 -0300

    net/sched: sch_qfq: account for stab overhead in qfq_enqueue

    commit 3e337087c3b5805fe0b8a46ba622a962880b5d64 upstream.

    Lion says:
    -------
    In the QFQ scheduler a similar issue to CVE-2023-31436
    persists.

    Consider the following code in net/sched/sch_qfq.c:

    static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch,
                    struct sk_buff **to_free)
    {
         unsigned int len = qdisc_pkt_len(skb), gso_segs;

        // ...

         if (unlikely(cl->agg->lmax < len)) {
             pr_debug("qfq: increasing maxpkt from %u to %u for class %u",
                  cl->agg->lmax, len, cl->common.classid);
             err = qfq_change_agg(sch, cl, cl->agg->class_weight, len);
             if (err) {
                 cl->qstats.drops++;
                 return qdisc_drop(skb, sch, to_free);
             }

        // ...

         }

    Similarly to CVE-2023-31436, "lmax" is increased without any bounds
    checks according to the packet length "len". Usually this would not
    impose a problem because packet sizes are naturally limited.

    This is however not the actual packet length, rather the
    "qdisc_pkt_len(skb)" which might apply size transformations according to
    "struct qdisc_size_table" as created by "qdisc_get_stab()" in
    net/sched/sch_api.c if the TCA_STAB option was set when modifying the qdisc.

    A user may choose virtually any size using such a table.

    As a result the same issue as in CVE-2023-31436 can occur, allowing heap
    out-of-bounds read / writes in the kmalloc-8192 cache.
    -------

    We can create the issue with the following commands:

    tc qdisc add dev $DEV root handle 1: stab mtu 2048 tsize 512 mpu 0 \
    overhead 999999999 linklayer ethernet qfq
    tc class add dev $DEV parent 1: classid 1:1 htb rate 6mbit burst 15k
    tc filter add dev $DEV parent 1: matchall classid 1:1
    ping -I $DEV 1.1.1.2

    This is caused by incorrectly assuming that qdisc_pkt_len() returns a
    length within the QFQ_MIN_LMAX < len < QFQ_MAX_LMAX.

    Fixes: 462dbc9101ac ("pkt_sched: QFQ Plus: fair-queueing service at DRR cost")
    Reported-by: Lion <nnamrec@gmail.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
    Reviewed-by: Simon Horman <simon.horman@corigine.com>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Shaoying Xu <shaoyi@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0817ecf2c713f4cf177e13d7e0a2c8d516b22aca
Author: M A Ramdhan <ramdhan@starlabs.sg>
Date:   Wed Jul 5 12:15:30 2023 -0400

    net/sched: cls_fw: Fix improper refcount update leads to use-after-free

    commit 0323bce598eea038714f941ce2b22541c46d488f upstream.

    In the event of a failure in tcf_change_indev(), fw_set_parms() will
    immediately return an error after incrementing or decrementing
    reference counter in tcf_bind_filter().  If attacker can control
    reference counter to zero and make reference freed, leading to
    use after free.

    In order to prevent this, move the point of possible failure above the
    point where the TC_FW_CLASSID is handled.

    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: M A Ramdhan <ramdhan@starlabs.sg>
    Signed-off-by: M A Ramdhan <ramdhan@starlabs.sg>
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Reviewed-by: Pedro Tammela <pctammela@mojatatu.com>
    Message-ID: <20230705161530.52003-1-ramdhan@starlabs.sg>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: SeongJae Park <sj@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f86ae20bdfcc921414d8a31bcfe4716eb2585911
Author: Jocelyn Falempe <jfalempe@redhat.com>
Date:   Tue Jul 11 11:20:43 2023 +0200

    drm/client: Fix memory leak in drm_client_target_cloned

    commit c2a88e8bdf5f6239948d75283d0ae7e0c7945b03 upstream.

    dmt_mode is allocated and never freed in this function.
    It was found with the ast driver, but most drivers using generic fbdev
    setup are probably affected.

    This fixes the following kmemleak report:
      backtrace:
        [<00000000b391296d>] drm_mode_duplicate+0x45/0x220 [drm]
        [<00000000e45bb5b3>] drm_client_target_cloned.constprop.0+0x27b/0x480 [drm]
        [<00000000ed2d3a37>] drm_client_modeset_probe+0x6bd/0xf50 [drm]
        [<0000000010e5cc9d>] __drm_fb_helper_initial_config_and_unlock+0xb4/0x2c0 [drm_kms_helper]
        [<00000000909f82ca>] drm_fbdev_client_hotplug+0x2bc/0x4d0 [drm_kms_helper]
        [<00000000063a69aa>] drm_client_register+0x169/0x240 [drm]
        [<00000000a8c61525>] ast_pci_probe+0x142/0x190 [ast]
        [<00000000987f19bb>] local_pci_probe+0xdc/0x180
        [<000000004fca231b>] work_for_cpu_fn+0x4e/0xa0
        [<0000000000b85301>] process_one_work+0x8b7/0x1540
        [<000000003375b17c>] worker_thread+0x70a/0xed0
        [<00000000b0d43cd9>] kthread+0x29f/0x340
        [<000000008d770833>] ret_from_fork+0x1f/0x30
    unreferenced object 0xff11000333089a00 (size 128):

    cc: <stable@vger.kernel.org>
    Fixes: 1d42bbc8f7f9 ("drm/fbdev: fix cloning on fbcon")
    Reported-by: Zhang Yi <yizhan@redhat.com>
    Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
    Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
    Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
    Link: https://patchwork.freedesktop.org/patch/msgid/20230711092203.68157-2-jfalempe@redhat.com
    Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2694217e8bde48190104ea89fc9556479145ee8a
Author: Joe Thornber <ejt@redhat.com>
Date:   Tue Jul 25 11:44:41 2023 -0400

    dm cache policy smq: ensure IO doesn't prevent cleaner policy progress

    commit 1e4ab7b4c881cf26c1c72b3f56519e03475486fb upstream.

    When using the cleaner policy to decommission the cache, there is
    never any writeback started from the cache as it is constantly delayed
    due to normal I/O keeping the device busy. Meaning @idle=false was
    always being passed to clean_target_met()

    Fix this by adding a specific 'cleaner' flag that is set when the
    cleaner policy is configured. This flag serves to always allow the
    cleaner's writeback work to be queued until the cache is
    decommissioned (even if the cache isn't idle).

    Reported-by: David Jeffery <djeffery@redhat.com>
    Fixes: b29d4986d0da ("dm cache: significant rework to leverage dm-bio-prison-v2")
    Cc: stable@vger.kernel.org
    Signed-off-by: Joe Thornber <ejt@redhat.com>
    Signed-off-by: Mike Snitzer <snitzer@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ae7210ef217e9dfa6372e7eb29d7ea2928f3954a
Author: Mark Brown <broonie@kernel.org>
Date:   Sun Jul 23 00:27:22 2023 +0100

    ASoC: wm8904: Fill the cache for WM8904_ADC_TEST_0 register

    commit f061e2be8689057cb4ec0dbffa9f03e1a23cdcb2 upstream.

    The WM8904_ADC_TEST_0 register is modified as part of updating the OSR
    controls but does not have a cache default, leading to errors when we try
    to modify these controls in cache only mode with no prior read:

    wm8904 3-001a: ASoC: error at snd_soc_component_update_bits on wm8904.3-001a for register: [0x000000c6] -16

    Add a read of the register to probe() to fill the cache and avoid both the
    error messages and the misconfiguration of the chip which will result.

    Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20230723-asoc-fix-wm8904-adc-test-read-v1-1-2cdf2edd83fd@kernel.org
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5f4559d58f16580586a045c03eb062da8ad400d0
Author: Stefan Haberland <sth@linux.ibm.com>
Date:   Fri Jul 21 21:36:44 2023 +0200

    s390/dasd: fix hanging device after quiesce/resume

    commit 05f1d8ed03f547054efbc4d29bb7991c958ede95 upstream.

    Quiesce and resume are functions that tell the DASD driver to stop/resume
    issuing I/Os to a specific DASD.

    On resume dasd_schedule_block_bh() is called to kick handling of IO
    requests again. This does unfortunately not cover internal requests which
    are used for path verification for example.

    This could lead to a hanging device when a path event or anything else
    that triggers internal requests occurs on a quiesced device.

    Fix by also calling dasd_schedule_device_bh() which triggers handling of
    internal requests on resume.

    Fixes: 8e09f21574ea ("[S390] dasd: add hyper PAV support to DASD device driver, part 1")

    Cc: stable@vger.kernel.org
    Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
    Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
    Link: https://lore.kernel.org/r/20230721193647.3889634-2-sth@linux.ibm.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a359b161e3d8205b7b726ec6a58dc685d7f6e685
Author: Jonas Gorski <jonas.gorski@gmail.com>
Date:   Thu Jun 29 09:26:20 2023 +0200

    irq-bcm6345-l1: Do not assume a fixed block to cpu mapping

    [ Upstream commit 55ad24857341c36616ecc1d9580af5626c226cf1 ]

    The irq to block mapping is fixed, and interrupts from the first block
    will always be routed to the first parent IRQ. But the parent interrupts
    themselves can be routed to any available CPU.

    This is used by the bootloader to map the first parent interrupt to the
    boot CPU, regardless wether the boot CPU is the first one or the second
    one.

    When booting from the second CPU, the assumption that the first block's
    IRQ is mapped to the first CPU breaks, and the system hangs because
    interrupts do not get routed correctly.

    Fix this by passing the appropriate bcm6434_l1_cpu to the interrupt
    handler instead of the chip itself, so the handler always has the right
    block.

    Fixes: c7c42ec2baa1 ("irqchips/bmips: Add bcm6345-l1 interrupt controller")
    Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Link: https://lore.kernel.org/r/20230629072620.62527-1-jonas.gorski@gmail.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit fdea4fafe9e8a94b80767589e89581e6ce804334
Author: Alexander Steffen <Alexander.Steffen@infineon.com>
Date:   Tue Jun 13 20:02:56 2023 +0200

    tpm_tis: Explicitly check for error code

    commit 513253f8c293c0c8bd46d09d337fc892bf8f9f48 upstream.

    recv_data either returns the number of received bytes, or a negative value
    representing an error code. Adding the return value directly to the total
    number of received bytes therefore looks a little weird, since it might add
    a negative error code to a sum of bytes.

    The following check for size < expected usually makes the function return
    ETIME in that case, so it does not cause too many problems in practice. But
    to make the code look cleaner and because the caller might still be
    interested in the original error code, explicitly check for the presence of
    an error code and pass that through.

    Cc: stable@vger.kernel.org
    Fixes: cb5354253af2 ("[PATCH] tpm: spacing cleanups 2")
    Signed-off-by: Alexander Steffen <Alexander.Steffen@infineon.com>
    Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 06b7fa7d3b645a000f5b26a95a2c8c0aad6b64a0
Author: Gilles Buloz <Gilles.Buloz@kontron.com>
Date:   Mon Jul 24 08:04:44 2023 +0000

    hwmon: (nct7802) Fix for temp6 (PECI1) processed even if PECI1 disabled

    commit 54685abe660a59402344d5045ce08c43c6a5ac42 upstream.

    Because of hex value 0x46 used instead of decimal 46, the temp6
    (PECI1) temperature is always declared visible and then displayed
    even if disabled in the chip

    Signed-off-by: Gilles Buloz <gilles.buloz@kontron.com>
    Link: https://lore.kernel.org/r/DU0PR10MB62526435ADBC6A85243B90E08002A@DU0PR10MB6252.EURPRD10.PROD.OUTLOOK.COM
    Fixes: fcdc5739dce03 ("hwmon: (nct7802) add temperature sensor type attribute")
    Cc: stable@vger.kernel.org
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fe143c48a08b4bad30a34a46f79ab444df980437
Author: Zhang Shurong <zhang_shurong@foxmail.com>
Date:   Sun Jul 9 13:50:07 2023 +0800

    staging: ks7010: potential buffer overflow in ks_wlan_set_encode_ext()

    commit 5f1c7031e044cb2fba82836d55cc235e2ad619dc upstream.

    The "exc->key_len" is a u16 that comes from the user.  If it's over
    IW_ENCODING_TOKEN_MAX (64) that could lead to memory corruption.

    Fixes: b121d84882b9 ("staging: ks7010: simplify calls to memcpy()")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
    Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
    Link: https://lore.kernel.org/r/tencent_5153B668C0283CAA15AA518325346E026A09@qq.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6c1f35e7bd377b329d6b04f5d46464a163c679ec
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Fri Jun 30 09:14:20 2023 +0200

    Documentation: security-bugs.rst: update preferences when dealing with the linux-distros group

    commit 4fee0915e649bd0cea56dece6d96f8f4643df33c upstream.

    Because the linux-distros group forces reporters to release information
    about reported bugs, and they impose arbitrary deadlines in having those
    bugs fixed despite not actually being kernel developers, the kernel
    security team recommends not interacting with them at all as this just
    causes confusion and the early-release of reported security problems.

    Reviewed-by: Kees Cook <keescook@chromium.org>
    Link: https://lore.kernel.org/r/2023063020-throat-pantyhose-f110@gregkh
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 622489d82062ea99b177f345851290501bdd75a2
Author: Ricardo Ribalda <ribalda@chromium.org>
Date:   Wed Jul 19 13:01:04 2023 +0000

    usb: xhci-mtk: set the dma max_seg_size

    commit 9fd10829a9eb482e192a845675ecc5480e0bfa10 upstream.

    Allow devices to have dma operations beyond 64K, and avoid warnings such
    as:

    DMA-API: xhci-mtk 11200000.usb: mapping sg segment longer than device claims to support [len=98304] [max=65536]

    Fixes: 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host controller")
    Cc: stable <stable@kernel.org>
    Tested-by: Zubin Mithra <zsm@chromium.org>
    Reported-by: Zubin Mithra <zsm@chromium.org>
    Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
    Link: https://lore.kernel.org/r/20230628-mtk-usb-v2-1-c8c34eb9f229@chromium.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2a20cb6aeeb7c906432252a5b839f4b9dbdc2663
Author: Guiting Shen <aarongt.shen@gmail.com>
Date:   Mon Jun 26 23:27:13 2023 +0800

    usb: ohci-at91: Fix the unhandle interrupt when resume

    commit c55afcbeaa7a6f4fffdbc999a9bf3f0b29a5186f upstream.

    The ohci_hcd_at91_drv_suspend() sets ohci->rh_state to OHCI_RH_HALTED when
    suspend which will let the ohci_irq() skip the interrupt after resume. And
    nobody to handle this interrupt.

    According to the comment in ohci_hcd_at91_drv_suspend(), it need to reset
    when resume from suspend(MEM) to fix by setting "hibernated" argument of
    ohci_resume().

    Signed-off-by: Guiting Shen <aarongt.shen@gmail.com>
    Cc: stable <stable@kernel.org>
    Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
    Link: https://lore.kernel.org/r/20230626152713.18950-1-aarongt.shen@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d7c72e66280e73a8fcf149a2e8ddafca21fbdb91
Author: Marc Kleine-Budde <mkl@pengutronix.de>
Date:   Tue Jul 18 11:43:54 2023 +0200

    can: gs_usb: gs_can_close(): add missing set of CAN state to CAN_STATE_STOPPED

    commit f8a2da6ec2417cca169fa85a8ab15817bccbb109 upstream.

    After an initial link up the CAN device is in ERROR-ACTIVE mode. Due
    to a missing CAN_STATE_STOPPED in gs_can_close() it doesn't change to
    STOPPED after a link down:

    | ip link set dev can0 up
    | ip link set dev can0 down
    | ip --details link show can0
    | 13: can0: <NOARP,ECHO> mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 10
    |     link/can  promiscuity 0 allmulti 0 minmtu 0 maxmtu 0
    |     can state ERROR-ACTIVE restart-ms 1000

    Add missing assignment of CAN_STATE_STOPPED in gs_can_close().

    Cc: stable@vger.kernel.org
    Fixes: d08e973a77d1 ("can: gs_usb: Added support for the GS_USB CAN devices")
    Link: https://lore.kernel.org/all/20230718-gs_usb-fix-can-state-v1-1-f19738ae2c23@pengutronix.de
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fb6acca01e3b7e6ef0e0ac2f394deaf35fc2a96d
Author: Johan Hovold <johan@kernel.org>
Date:   Thu Jul 20 09:53:57 2023 +0200

    USB: serial: simple: sort driver entries

    commit d245aedc00775c4d7265a9f4522cc4e1fd34d102 upstream.

    Sort the driver symbols alphabetically in order to make it more obvious
    where new driver entries should be added.

    Cc: stable@vger.kernel.org
    Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ba1fc639f4a5ddec5463f9dd5e6ff49d3dfce9fd
Author: Oliver Neukum <oneukum@suse.com>
Date:   Wed Jul 12 16:16:41 2023 +0200

    USB: serial: simple: add Kaufmann RKS+CAN VCP

    commit dd92c8a1f99bcd166204ffc219ea5a23dd65d64f upstream.

    Add the device and product ID for this CAN bus interface / license
    dongle. The device is usable either directly from user space or can be
    attached to a kernel CAN interface with slcan_attach.

    Reported-by: Kaufmann Automotive GmbH <info@kaufmann-automotive.ch>
    Tested-by: Kaufmann Automotive GmbH <info@kaufmann-automotive.ch>
    Signed-off-by: Oliver Neukum <oneukum@suse.com>
    [ johan: amend commit message and move entries in sort order ]
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 023be537d8e47caef04ad95aa8640a7ec61f0fb2
Author: Mohsen Tahmasebi <moh53n@moh53n.ir>
Date:   Mon Jul 10 11:22:18 2023 +0330

    USB: serial: option: add Quectel EC200A module support

    commit 857ea9005806e2a458016880278f98715873e977 upstream.

    Add Quectel EC200A "DIAG, AT, MODEM":

    0x6005: ECM / RNDIS + DIAG + AT + MODEM

    T:  Bus=01 Lev=01 Prnt=02 Port=05 Cnt=01 Dev#=  8 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=2c7c ProdID=6005 Rev=03.18
    S:  Manufacturer=Android
    S:  Product=Android
    S:  SerialNumber=0000
    C:  #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=06 Prot=00 Driver=cdc_ether
    E:  Ad=87(I) Atr=03(Int.) MxPS=  64 Ivl=4096ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
    E:  Ad=0c(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=0b(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=89(I) Atr=03(Int.) MxPS=  64 Ivl=4096ms
    I:  If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=0a(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=88(I) Atr=03(Int.) MxPS=  64 Ivl=4096ms

    Signed-off-by: Mohsen Tahmasebi <moh53n@moh53n.ir>
    Tested-by: Mostafa Ghofrani <mostafaghrr@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit cf7fb6904c44b6ecad64967d90492b855ceb57fe
Author: Jerry Meng <jerry-meng@foxmail.com>
Date:   Thu Jun 29 17:35:22 2023 +0800

    USB: serial: option: support Quectel EM060K_128

    commit 4f7cab49cecee16120d27c1734cfdf3d6c0e5329 upstream.

    EM060K_128 is EM060K's sub-model, having the same name "Quectel EM060K-GL"

    MBIM + GNSS + DIAG + NMEA + AT + QDSS + DPL

    T:  Bus=03 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#=  8 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=2c7c ProdID=0128 Rev= 5.04
    S:  Manufacturer=Quectel
    S:  Product=Quectel EM060K-GL
    S:  SerialNumber=f6fa08b6
    C:* #Ifs= 8 Cfg#= 1 Atr=a0 MxPwr=500mA
    A:  FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
    I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 2 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=40 Driver=option
    E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 6 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none)
    E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
    E:  Ad=8f(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

    Signed-off-by: Jerry Meng <jerry-meng@foxmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 99c8f21ca4f2d19b2f14566f6ee85bbf66e8be21
Author: Zheng Yejian <zhengyejian1@huawei.com>
Date:   Wed Jul 26 17:58:04 2023 +0800

    tracing: Fix warning in trace_buffered_event_disable()

    [ Upstream commit dea499781a1150d285c62b26659f62fb00824fce ]

    Warning happened in trace_buffered_event_disable() at
      WARN_ON_ONCE(!trace_buffered_event_ref)

      Call Trace:
       ? __warn+0xa5/0x1b0
       ? trace_buffered_event_disable+0x189/0x1b0
       __ftrace_event_enable_disable+0x19e/0x3e0
       free_probe_data+0x3b/0xa0
       unregister_ftrace_function_probe_func+0x6b8/0x800
       event_enable_func+0x2f0/0x3d0
       ftrace_process_regex.isra.0+0x12d/0x1b0
       ftrace_filter_write+0xe6/0x140
       vfs_write+0x1c9/0x6f0
       [...]

    The cause of the warning is in __ftrace_event_enable_disable(),
    trace_buffered_event_enable() was called once while
    trace_buffered_event_disable() was called twice.
    Reproduction script show as below, for analysis, see the comments:
     ```
     #!/bin/bash

     cd /sys/kernel/tracing/

     # 1. Register a 'disable_event' command, then:
     #    1) SOFT_DISABLED_BIT was set;
     #    2) trace_buffered_event_enable() was called first time;
     echo 'cmdline_proc_show:disable_event:initcall:initcall_finish' > \
         set_ftrace_filter

     # 2. Enable the event registered, then:
     #    1) SOFT_DISABLED_BIT was cleared;
     #    2) trace_buffered_event_disable() was called first time;
     echo 1 > events/initcall/initcall_finish/enable

     # 3. Try to call into cmdline_proc_show(), then SOFT_DISABLED_BIT was
     #    set again!!!
     cat /proc/cmdline

     # 4. Unregister the 'disable_event' command, then:
     #    1) SOFT_DISABLED_BIT was cleared again;
     #    2) trace_buffered_event_disable() was called second time!!!
     echo '!cmdline_proc_show:disable_event:initcall:initcall_finish' > \
         set_ftrace_filter
     ```

    To fix it, IIUC, we can change to call trace_buffered_event_enable() at
    fist time soft-mode enabled, and call trace_buffered_event_disable() at
    last time soft-mode disabled.

    Link: https://lore.kernel.org/linux-trace-kernel/20230726095804.920457-1-zhengyejian1@huawei.com

    Cc: <mhiramat@kernel.org>
    Fixes: 0fc1b09ff1ff ("tracing: Use temp buffer when filtering events")
    Signed-off-by: Zheng Yejian <zhengyejian1@huawei.com>
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6baef623c6a7e98b3ce08b5fa14ac77ecc4da594
Author: Zheng Yejian <zhengyejian1@huawei.com>
Date:   Mon Jul 24 13:40:40 2023 +0800

    ring-buffer: Fix wrong stat of cpu_buffer->read

    [ Upstream commit 2d093282b0d4357373497f65db6a05eb0c28b7c8 ]

    When pages are removed in rb_remove_pages(), 'cpu_buffer->read' is set
    to 0 in order to make sure any read iterators reset themselves. However,
    this will mess 'entries' stating, see following steps:

      # cd /sys/kernel/tracing/
      # 1. Enlarge ring buffer prepare for later reducing:
      # echo 20 > per_cpu/cpu0/buffer_size_kb
      # 2. Write a log into ring buffer of cpu0:
      # taskset -c 0 echo "hello1" > trace_marker
      # 3. Read the log:
      # cat per_cpu/cpu0/trace_pipe
           <...>-332     [000] .....    62.406844: tracing_mark_write: hello1
      # 4. Stop reading and see the stats, now 0 entries, and 1 event readed:
      # cat per_cpu/cpu0/stats
       entries: 0
       [...]
       read events: 1
      # 5. Reduce the ring buffer
      # echo 7 > per_cpu/cpu0/buffer_size_kb
      # 6. Now entries became unexpected 1 because actually no entries!!!
      # cat per_cpu/cpu0/stats
       entries: 1
       [...]
       read events: 0

    To fix it, introduce 'page_removed' field to count total rem…
bggRGjQaUbCoE pushed a commit to bggRGjQaUbCoE/android_kernel_samsung_sm8250-mohammad92 that referenced this issue Dec 18, 2023
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
ratatouille100 pushed a commit to ratatouille100/kernel_samsung_universal9611 that referenced this issue Dec 19, 2023
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
user-why-red pushed a commit to user-why-red/android_kernel_xiaomi_sdm660_419 that referenced this issue Dec 31, 2023
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
LucasBlackLu pushed a commit to LucasBlackLu/kernel_google_redbull that referenced this issue Jan 3, 2024
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
LucasBlackLu pushed a commit to LucasBlackLu/kernel_google_msm-4.14 that referenced this issue Jan 4, 2024
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
LucasBlackLu pushed a commit to LucasBlackLu/kernel_google_redbull that referenced this issue Jan 5, 2024
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
LucasBlackLu pushed a commit to LucasBlackLu/kernel_google_redbull that referenced this issue Jan 8, 2024
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
yamaizano pushed a commit to yamaizano/android_kernel_xiaomi_sdm660 that referenced this issue Jan 14, 2024
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
changhuapeng pushed a commit to changhuapeng/android_kernel_xiaomi_surya that referenced this issue Jan 21, 2024
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
Tested-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
RT1648 pushed a commit to RT1648/android_kernel_realme_RMP6768 that referenced this issue Jan 24, 2024
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
HowWof pushed a commit to HowWof/android_kernel_realme_mt6785 that referenced this issue Feb 3, 2024
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
renoxtv pushed a commit to renoxtv/s21ultra5GSEKS that referenced this issue Feb 5, 2024
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
RT1648 pushed a commit to RT1648/android_kernel_realme_RMP6768 that referenced this issue Feb 14, 2024
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
backslashxx pushed a commit to backslashxx/android_karnol_ximi_fog that referenced this issue Feb 15, 2024
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
wanghao75 pushed a commit to openeuler-mirror/kernel that referenced this issue Feb 22, 2024
…ndianness

stable inclusion
from stable-v5.10.190
commit 4241cfc973ad8bc3d3a68b532b014e880c21b35f
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I928UI

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=4241cfc973ad8bc3d3a68b532b014e880c21b35f

--------------------------------

[ Upstream commit 79e8328 ]

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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
Signed-off-by: sanglipeng <sanglipeng1@jd.com>
Fastlens pushed a commit to Fastlens/android_kernel_realme_mt6785 that referenced this issue Mar 3, 2024
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
eclipse-oniro-oh-bot pushed a commit to eclipse-oniro-mirrors/kernel_linux_5.10 that referenced this issue Mar 30, 2024
…ndianness

stable inclusion
from stable-5.10.190
commit 4241cfc973ad8bc3d3a68b532b014e880c21b35f
category: bugfix
issue: #I9BOSS
CVE: NA

Signed-off-by: wanxiaoqing <wanxiaoqing@huawei.com>
---------------------------------------

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
Signed-off-by: wanxiaoqing <wanxiaoqing@huawei.com>
bellegarde-c pushed a commit to gnumdk-miatoll/linux-android-xiaomi-miatoll that referenced this issue Apr 12, 2024
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
aled99 pushed a commit to aled99/kernel_xiaomi_sm8250 that referenced this issue Apr 15, 2024
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
xt0032rus pushed a commit to xt0032rus/android_kernel_xiaomi_sm8550 that referenced this issue May 3, 2024
…ndianness

[ 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: ClangBuiltLinux/linux#1832
Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
Fixes: 36126f8 ("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>
Signed-off-by: xt0032rus <andrey.denikin9@mail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-Wbitwise-instead-of-logical [ARCH] arm64 This bug impacts ARCH=arm64 [BUG] linux A bug that should be fixed in the mainline kernel. [FIXED][LINUX] 6.5 This bug was fixed in Linux 6.5
Projects
None yet
Development

No branches or pull requests

2 participants