aboutsummaryrefslogtreecommitdiffstats
path: root/lib/string.c
diff options
context:
space:
mode:
authorDouglas Anderson <[email protected]>2024-01-26 15:28:53 +0000
committerKees Cook <[email protected]>2024-02-01 17:44:07 +0000
commit735b7636d1a88e85eeef607a8179a114618bc5a0 (patch)
tree96006fe78f74e2b4b97279d26e59257d6f9db763 /lib/string.c
parentlkdtm/bugs: Adjust lkdtm_HUNG_TASK() to avoid tail call optimization (diff)
downloadkernel-735b7636d1a88e85eeef607a8179a114618bc5a0.tar.gz
kernel-735b7636d1a88e85eeef607a8179a114618bc5a0.zip
lkdtm/bugs: In lkdtm_HUNG_TASK() use BUG(), not BUG_ON(1)
In commit edb6538da3df ("lkdtm/bugs: Adjust lkdtm_HUNG_TASK() to avoid tail call optimization") we marked lkdtm_HUNG_TASK() as __noreturn. The compiler gets unhappy if it thinks a __noreturn function might return, so there's a BUG_ON(1) at the end. Any human can see that the function won't return and the compiler can figure that out too. Except when it can't. The MIPS architecture defines HAVE_ARCH_BUG_ON and defines its own version of BUG_ON(). The MIPS version of BUG_ON() is not a macro but is instead an inline function. Apparently this prevents the compiler from realizing that the condition to BUG_ON() is constant and that the function will never return. Let's change the BUG_ON(1) to just BUG(), which it should have been to begin with. The only reason I used BUG_ON(1) to begin with was because I was used to using WARN_ON(1) when writing test code and WARN() and BUG() are oddly inconsistent in this manner. :-/ Fixes: edb6538da3df ("lkdtm/bugs: Adjust lkdtm_HUNG_TASK() to avoid tail call optimization") Signed-off-by: Douglas Anderson <[email protected]> Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Acked-by: Arnd Bergmann <[email protected]> Link: https://lore.kernel.org/r/20240126072852.1.Ib065e528a8620474a72f15baa2feead1f3d89865@changeid Signed-off-by: Kees Cook <[email protected]>
Diffstat (limited to 'lib/string.c')
0 files changed, 0 insertions, 0 deletions