[next] kernel/smpboot.c:435:6: error: variable 'oldstate' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]

0 views
Skip to first unread message

Naresh Kamboju

unread,
Aug 25, 2022, 6:48:55 AM8/25/22
to Uros Bizjak, Andrew Morton, regre...@lists.linux.dev, lkft-...@lists.linaro.org, clang-built-linux, Nathan Chancellor, Linux-Next Mailing List, Longpeng(Mike), Thomas Gleixner, Sebastian Andrzej Siewior
The x86_64 and i386 clang builds failed due to these warnings / errors
on Linux next-20220825.

Reported-by: Linux Kernel Functional Testing <lk...@linaro.org>

kernel/smpboot.c:435:6: error: variable 'oldstate' is used
uninitialized whenever 'if' condition is true
[-Werror,-Wsometimes-uninitialized]
if (atomic_read(&per_cpu(cpu_hotplug_state, cpu)) == CPU_DEAD)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/smpboot.c:449:6: note: uninitialized use occurs here
if (oldstate == CPU_DEAD) {
^~~~~~~~
kernel/smpboot.c:435:2: note: remove the 'if' if its condition is always false
if (atomic_read(&per_cpu(cpu_hotplug_state, cpu)) == CPU_DEAD)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/smpboot.c:428:14: note: initialize the variable 'oldstate' to
silence this warning
int oldstate;
^
= 0
1 error generated.
make[2]: *** [scripts/Makefile.build:250: kernel/smpboot.o] Error 1

Build link: https://builds.tuxbuild.com/2Dpvef6uVvzHMztbfQRmxJfPXZT/

Steps to reproduce:
-------------------
# To install tuxmake on your system globally:
# sudo pip3 install -U tuxmake

tuxmake --runtime podman --target-arch x86_64 --toolchain clang-14
--kconfig https://builds.tuxbuild.com/2Dpvef6uVvzHMztbfQRmxJfPXZT/config
LLVM=1 LLVM_IAS=1

--
Linaro LKFT
https://lkft.linaro.org

Uros Bizjak

unread,
Aug 25, 2022, 7:07:31 AM8/25/22
to Naresh Kamboju, Andrew Morton, regre...@lists.linux.dev, lkft-...@lists.linaro.org, clang-built-linux, Nathan Chancellor, Linux-Next Mailing List, Longpeng(Mike), Thomas Gleixner, Sebastian Andrzej Siewior
On Thu, Aug 25, 2022 at 12:48 PM Naresh Kamboju
<naresh....@linaro.org> wrote:
>
> The x86_64 and i386 clang builds failed due to these warnings / errors
> on Linux next-20220825.
>
> Reported-by: Linux Kernel Functional Testing <lk...@linaro.org>
>
> kernel/smpboot.c:435:6: error: variable 'oldstate' is used
> uninitialized whenever 'if' condition is true
> [-Werror,-Wsometimes-uninitialized]
> if (atomic_read(&per_cpu(cpu_hotplug_state, cpu)) == CPU_DEAD)
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> kernel/smpboot.c:449:6: note: uninitialized use occurs here
> if (oldstate == CPU_DEAD) {
> ^~~~~~~~
> kernel/smpboot.c:435:2: note: remove the 'if' if its condition is always false
> if (atomic_read(&per_cpu(cpu_hotplug_state, cpu)) == CPU_DEAD)
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> kernel/smpboot.c:428:14: note: initialize the variable 'oldstate' to
> silence this warning
> int oldstate;
> ^
> = 0
> 1 error generated.
> make[2]: *** [scripts/Makefile.build:250: kernel/smpboot.o] Error 1
>
> Build link: https://builds.tuxbuild.com/2Dpvef6uVvzHMztbfQRmxJfPXZT/

Please see

https://lore.kernel.org/lkml/CAFULd4bgdGosQ3byMW9S+ov0...@mail.gmail.com/

for the fix.

Uros.
Reply all
Reply to author
Forward
0 new messages