All of lore.kernel.org
 help / color / mirror / Atom feed
* clang: mm/khugepaged.c:1729:7: error: variable 'index' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
@ 2022-10-25 20:13 Naresh Kamboju
  2022-10-25 20:16 ` Nathan Chancellor
  0 siblings, 1 reply; 2+ messages in thread
From: Naresh Kamboju @ 2022-10-25 20:13 UTC (permalink / raw)
  To: linux-mm, open list, lkft-triage, llvm
  Cc: Andrew Morton, Gautam Menghani, David Hildenbrand,
	Steven Rostedt, Vlastimil Babka, Yang Shi, Zach O'Keefe,
	Kirill A. Shutemov, Masami Hiramatsu

Following build warning / errors noticed while building x86_64 with clang
on Linux next-20221025 tag.

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

## Build
* kernel: 6.1.0-rc2
* git: https://gitlab.com/Linaro/lkft/mirrors/next/linux-next
* git branch: master
* git commit: 89bf6e28373beef9577fa71f996a5f73a569617c
* git describe: next-20221025
* test details:
https://qa-reports.linaro.org/lkft/linux-next-master-sanity/build/next-20221025

## Test Regressions (compared to next-20221024)
Regressions found on x86_64:

 - clang-nightly-lkftconfig
 - clang-12-lkftconfig
 - clang-14-lkftconfig
 - clang-13-lkftconfig
 - clang-14-lkftconfig-kcsan

make --silent --keep-going --jobs=8
O=/home/tuxbuild/.cache/tuxmake/builds/1/build LLVM=1 LLVM_IAS=1
ARCH=x86_64 CROSS_COMPILE=x86_64-linux-gnu- 'HOSTCC=sccache clang'
'CC=sccache clang'
mm/khugepaged.c:1729:7: error: variable 'index' is used uninitialized
whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
                if (!xas_nomem(&xas, GFP_KERNEL)) {
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
mm/khugepaged.c:2063:47: note: uninitialized use occurs here
        trace_mm_khugepaged_collapse_file(mm, hpage, index, is_shmem,
                                                     ^~~~~
mm/khugepaged.c:1729:3: note: remove the 'if' if its condition is always false
                if (!xas_nomem(&xas, GFP_KERNEL)) {
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mm/khugepaged.c:1716:6: error: variable 'index' is used uninitialized
whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
        if (result != SCAN_SUCCEED)
            ^~~~~~~~~~~~~~~~~~~~~~
mm/khugepaged.c:2063:47: note: uninitialized use occurs here
        trace_mm_khugepaged_collapse_file(mm, hpage, index, is_shmem,
                                                     ^~~~~
mm/khugepaged.c:1716:2: note: remove the 'if' if its condition is always false
        if (result != SCAN_SUCCEED)
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
mm/khugepaged.c:1705:15: note: initialize the variable 'index' to
silence this warning
        pgoff_t index, end = start + HPAGE_PMD_NR;
                     ^
                      = 0
mm/khugepaged.c:1729:7: error: variable 'nr' is used uninitialized
whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
                if (!xas_nomem(&xas, GFP_KERNEL)) {
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
mm/khugepaged.c:2064:15: note: uninitialized use occurs here
                addr, file, nr, result);
                            ^~
mm/khugepaged.c:1729:3: note: remove the 'if' if its condition is always false
                if (!xas_nomem(&xas, GFP_KERNEL)) {
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mm/khugepaged.c:1716:6: error: variable 'nr' is used uninitialized
whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
        if (result != SCAN_SUCCEED)
            ^~~~~~~~~~~~~~~~~~~~~~
mm/khugepaged.c:2064:15: note: uninitialized use occurs here
                addr, file, nr, result);
                            ^~
mm/khugepaged.c:1716:2: note: remove the 'if' if its condition is always false
        if (result != SCAN_SUCCEED)
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
mm/khugepaged.c:1710:8: note: initialize the variable 'nr' to silence
this warning
        int nr;
              ^
               = 0
4 errors generated.
make[3]: *** [scripts/Makefile.build:250: mm/khugepaged.o] Error 1

steps to reproduce:
# To install tuxmake on your system globally:
# sudo pip3 install -U tuxmake
#
# See https://docs.tuxmake.org/ for complete documentation.
# Original tuxmake command with fragments listed below.
# tuxmake --runtime podman --target-arch x86_64 --toolchain clang-14
--kconfig defconfig --kconfig-add
https://raw.githubusercontent.com/Linaro/meta-lkft/kirkstone/meta/recipes-kernel/linux/files/lkft.config
--kconfig-add https://raw.githubusercontent.com/Linaro/meta-lkft/kirkstone/meta/recipes-kernel/linux/files/lkft-crypto.config
--kconfig-add https://raw.githubusercontent.com/Linaro/meta-lkft/kirkstone/meta/recipes-kernel/linux/files/distro-overrides.config
--kconfig-add https://raw.githubusercontent.com/Linaro/meta-lkft/kirkstone/meta/recipes-kernel/linux/files/systemd.config
--kconfig-add https://raw.githubusercontent.com/Linaro/meta-lkft/kirkstone/meta/recipes-kernel/linux/files/virtio.config
--kconfig-add CONFIG_IGB=y --kconfig-add
CONFIG_UNWINDER_FRAME_POINTER=y LLVM=1 LLVM_IAS=1


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

Build link,
 - https://builds.tuxbuild.com/2Gc0JDbUOIN0veL39dqIt03qgEi/

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: clang: mm/khugepaged.c:1729:7: error: variable 'index' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
  2022-10-25 20:13 clang: mm/khugepaged.c:1729:7: error: variable 'index' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized] Naresh Kamboju
@ 2022-10-25 20:16 ` Nathan Chancellor
  0 siblings, 0 replies; 2+ messages in thread
From: Nathan Chancellor @ 2022-10-25 20:16 UTC (permalink / raw)
  To: Naresh Kamboju
  Cc: linux-mm, open list, lkft-triage, llvm, Andrew Morton,
	Gautam Menghani, David Hildenbrand, Steven Rostedt,
	Vlastimil Babka, Yang Shi, Zach O'Keefe, Kirill A. Shutemov,
	Masami Hiramatsu

On Wed, Oct 26, 2022 at 01:43:48AM +0530, Naresh Kamboju wrote:
> Following build warning / errors noticed while building x86_64 with clang
> on Linux next-20221025 tag.
> 
> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> 
> ## Build
> * kernel: 6.1.0-rc2
> * git: https://gitlab.com/Linaro/lkft/mirrors/next/linux-next
> * git branch: master
> * git commit: 89bf6e28373beef9577fa71f996a5f73a569617c
> * git describe: next-20221025
> * test details:
> https://qa-reports.linaro.org/lkft/linux-next-master-sanity/build/next-20221025
> 
> ## Test Regressions (compared to next-20221024)
> Regressions found on x86_64:
> 
>  - clang-nightly-lkftconfig
>  - clang-12-lkftconfig
>  - clang-14-lkftconfig
>  - clang-13-lkftconfig
>  - clang-14-lkftconfig-kcsan
> 
> make --silent --keep-going --jobs=8
> O=/home/tuxbuild/.cache/tuxmake/builds/1/build LLVM=1 LLVM_IAS=1
> ARCH=x86_64 CROSS_COMPILE=x86_64-linux-gnu- 'HOSTCC=sccache clang'
> 'CC=sccache clang'
> mm/khugepaged.c:1729:7: error: variable 'index' is used uninitialized
> whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
>                 if (!xas_nomem(&xas, GFP_KERNEL)) {
>                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> mm/khugepaged.c:2063:47: note: uninitialized use occurs here
>         trace_mm_khugepaged_collapse_file(mm, hpage, index, is_shmem,
>                                                      ^~~~~
> mm/khugepaged.c:1729:3: note: remove the 'if' if its condition is always false
>                 if (!xas_nomem(&xas, GFP_KERNEL)) {
>                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> mm/khugepaged.c:1716:6: error: variable 'index' is used uninitialized
> whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
>         if (result != SCAN_SUCCEED)
>             ^~~~~~~~~~~~~~~~~~~~~~
> mm/khugepaged.c:2063:47: note: uninitialized use occurs here
>         trace_mm_khugepaged_collapse_file(mm, hpage, index, is_shmem,
>                                                      ^~~~~
> mm/khugepaged.c:1716:2: note: remove the 'if' if its condition is always false
>         if (result != SCAN_SUCCEED)
>         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> mm/khugepaged.c:1705:15: note: initialize the variable 'index' to
> silence this warning
>         pgoff_t index, end = start + HPAGE_PMD_NR;
>                      ^
>                       = 0
> mm/khugepaged.c:1729:7: error: variable 'nr' is used uninitialized
> whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
>                 if (!xas_nomem(&xas, GFP_KERNEL)) {
>                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> mm/khugepaged.c:2064:15: note: uninitialized use occurs here
>                 addr, file, nr, result);
>                             ^~
> mm/khugepaged.c:1729:3: note: remove the 'if' if its condition is always false
>                 if (!xas_nomem(&xas, GFP_KERNEL)) {
>                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> mm/khugepaged.c:1716:6: error: variable 'nr' is used uninitialized
> whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
>         if (result != SCAN_SUCCEED)
>             ^~~~~~~~~~~~~~~~~~~~~~
> mm/khugepaged.c:2064:15: note: uninitialized use occurs here
>                 addr, file, nr, result);
>                             ^~
> mm/khugepaged.c:1716:2: note: remove the 'if' if its condition is always false
>         if (result != SCAN_SUCCEED)
>         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> mm/khugepaged.c:1710:8: note: initialize the variable 'nr' to silence
> this warning
>         int nr;
>               ^
>                = 0
> 4 errors generated.
> make[3]: *** [scripts/Makefile.build:250: mm/khugepaged.o] Error 1

I sent
https://lore.kernel.org/20221025173407.3423241-1-nathan@kernel.org/ for
this earlier today.

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-25 20:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-25 20:13 clang: mm/khugepaged.c:1729:7: error: variable 'index' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized] Naresh Kamboju
2022-10-25 20:16 ` Nathan Chancellor

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.