Re: [BUG] -next objtool build failure (bisected)

From: Josh Poimboeuf
Date: Tue Oct 15 2024 - 14:45:14 EST


On Tue, Oct 15, 2024 at 11:10:11AM -0700, Paul E. McKenney wrote:
> Hello!
>
> The next-20241011 release gets me build errors like the following:
>
> vmlinux.o: warning: objtool: fetch_item() falls through to next function
>
> Bisection leads me here:
>
> 61595012f280 ("HID: simplify code in fetch_item()")
>
> This diff looks inoffensive to me, but I get this error on this commit
> and not on its predecessor.
>
> This build failure happens on quite a few different kernel configurations.
> I bisected using this particular reproducer:
>
> tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --buildonly --configs SRCU-T

The problem is likely this:

+ default:
+ unreachable();

The unreachable() annotation by itself produces undefined behavior, as
it will just fall off the edge of the function if the default case is
ever executed.

Better to do

default:
BUG();

which makes the behavior defined.

--
Josh