All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Naresh Kamboju <naresh.kamboju@linaro.org>
Cc: linux-mm <linux-mm@kvack.org>,
	open list <linux-kernel@vger.kernel.org>,
	lkft-triage@lists.linaro.org, llvm@lists.linux.dev,
	Andrew Morton <akpm@linux-foundation.org>,
	Gautam Menghani <gautammenghani201@gmail.com>,
	David Hildenbrand <david@redhat.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Vlastimil Babka <vbabka@suse.cz>, Yang Shi <shy828301@gmail.com>,
	Zach O'Keefe <zokeefe@google.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Masami Hiramatsu <mhiramat@kernel.org>
Subject: Re: clang: mm/khugepaged.c:1729:7: error: variable 'index' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
Date: Tue, 25 Oct 2022 13:16:24 -0700	[thread overview]
Message-ID: <Y1hEGOJESbuePox2@dev-arch.thelio-3990X> (raw)
In-Reply-To: <CA+G9fYucNpHyqt-24OURGSndrBB0z5crq_X0KZTwqQppw9T6fA@mail.gmail.com>

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

      reply	other threads:[~2022-10-25 20:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y1hEGOJESbuePox2@dev-arch.thelio-3990X \
    --to=nathan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=gautammenghani201@gmail.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lkft-triage@lists.linaro.org \
    --cc=llvm@lists.linux.dev \
    --cc=mhiramat@kernel.org \
    --cc=naresh.kamboju@linaro.org \
    --cc=rostedt@goodmis.org \
    --cc=shy828301@gmail.com \
    --cc=vbabka@suse.cz \
    --cc=zokeefe@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.