Re: [PATCH] selftests/timers/posix_timers: reimplement check_timer_distribution()

From: John Stultz
Date: Thu Apr 11 2024 - 11:53:45 EST


On Thu, Apr 11, 2024 at 5:42 AM Mark Brown <broonie@xxxxxxxxxx> wrote:
> On Sat, Apr 06, 2024 at 05:09:51PM +0200, Oleg Nesterov wrote:
> > Without the commit bcb7ee79029d ("posix-timers: Prefer delivery of signals
> > to the current thread") the test-case fails immediately, the very 1st tick
> > wakes the leader up. Otherwise it quickly succeeds after 100 ticks.
>
> This has landed in -next and is causing warning spam throughout
> kselftest when built with clang:
>
> /home/broonie/git/bisect/tools/testing/selftests/kselftest.h:435:6: warning: variable 'major' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized]
> if (uname(&info) || sscanf(info.release, "%u.%u.", &major, &minor) != 2)
> ^~~~~~~~~~~~
> /home/broonie/git/bisect/tools/testing/selftests/kselftest.h:438:9: note: uninitialized use occurs here
> return major > min_major || (major == min_major && minor >= min_minor);
> ^~~~~
> /home/broonie/git/bisect/tools/testing/selftests/kselftest.h:435:6: note: remove the '||' if its condition is always false
> if (uname(&info) || sscanf(info.release, "%u.%u.", &major, &minor) != 2)
> ^~~~~~~~~~~~~~~
> /home/broonie/git/bisect/tools/testing/selftests/kselftest.h:432:20: note: initialize the variable 'major' to silence this warning
> unsigned int major, minor;
> ^
> = 0

I hit this one too yesterday and included a fix for it here:
https://lore.kernel.org/lkml/20240410232637.4135564-2-jstultz@xxxxxxxxxx/

thanks
-john