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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 25, 2022 at 12:48 PM Naresh Kamboju
<naresh.kamboju@xxxxxxxxxx> wrote:
>
> The x86_64 and i386 clang builds failed due to these warnings / errors
> on Linux next-20220825.
>
> Reported-by: Linux Kernel Functional Testing <lkft@xxxxxxxxxx>
>
> 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+ov0uDO9iK3jCmZ-fkZQbCGOpfUvXQ@xxxxxxxxxxxxxx/

for the fix.

Uros.

> 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



[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux