linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yang Shi <shy828301@gmail.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: Naoya Horiguchi <naoya.horiguchi@nec.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	 Nick Desaulniers <ndesaulniers@google.com>,
	Linux MM <linux-mm@kvack.org>,
	 Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	llvm@lists.linux.dev,  "kernelci.org bot" <bot@kernelci.org>
Subject: Re: [PATCH] mm/memory_failure: Initialize extra_pins in me_pagecache_clean()
Date: Thu, 21 Oct 2021 11:15:38 -0700	[thread overview]
Message-ID: <CAHbLzkpYgLLrJmeSY5YEJoK4d+pRaotwBVyz9k1b9hY4AmavDw@mail.gmail.com> (raw)
In-Reply-To: <20211021180336.2328086-1-nathan@kernel.org>

On Thu, Oct 21, 2021 at 11:04 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> Clang warns:
>
> mm/memory-failure.c:892:6: error: variable 'extra_pins' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
>         if (!mapping) {
>             ^~~~~~~~
> mm/memory-failure.c:915:32: note: uninitialized use occurs here
>         if (has_extra_refcount(ps, p, extra_pins))
>                                       ^~~~~~~~~~
> mm/memory-failure.c:892:2: note: remove the 'if' if its condition is always false
>         if (!mapping) {
>         ^~~~~~~~~~~~~~~
> mm/memory-failure.c:879:6: error: variable 'extra_pins' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
>         if (PageAnon(p)) {
>             ^~~~~~~~~~~
> mm/memory-failure.c:915:32: note: uninitialized use occurs here
>         if (has_extra_refcount(ps, p, extra_pins))
>                                       ^~~~~~~~~~
> mm/memory-failure.c:879:2: note: remove the 'if' if its condition is always false
>         if (PageAnon(p)) {
>         ^~~~~~~~~~~~~~~~~~
> mm/memory-failure.c:871:17: note: initialize the variable 'extra_pins' to silence this warning
>         bool extra_pins;
>                        ^
>                         = 0
> 2 errors generated.
>
> Initialize extra_pins to false so that it is not used uninitialized.
>
> Fixes: d882a43a0011 ("mm: shmem: don't truncate page if memory failure happens")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1487
> Reported-by: "kernelci.org bot" <bot@kernelci.org>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>
> I am aware the fixes tag is not stable. It is there to convey this
> should be squashed into mm-shmem-dont-truncate-page-if-memory-failure-happens.patch.

Thanks for catching this. Acked-by: Yang Shi <shy828301@gmail.com>

>
>  mm/memory-failure.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index 3b04f0361a58..dba5f0098165 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -868,7 +868,7 @@ static int me_pagecache_clean(struct page_state *ps, struct page *p)
>  {
>         int ret;
>         struct address_space *mapping;
> -       bool extra_pins;
> +       bool extra_pins = false;
>
>         delete_from_lru_cache(p);
>
> --
> 2.33.1.637.gf443b226ca
>


      reply	other threads:[~2021-10-21 18:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21 18:03 Nathan Chancellor
2021-10-21 18:15 ` Yang Shi [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=CAHbLzkpYgLLrJmeSY5YEJoK4d+pRaotwBVyz9k1b9hY4AmavDw@mail.gmail.com \
    --to=shy828301@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bot@kernelci.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=llvm@lists.linux.dev \
    --cc=naoya.horiguchi@nec.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox