linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Waiman Long <longman@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
	Michal Hocko <mhocko@kernel.org>,
	Vladimir Davydov <vdavydov.dev@gmail.com>,
	linux-kernel@vger.kernel.org, cgroups@vger.kernel.org,
	linux-mm@kvack.org, Muchun Song <songmuchun@bytedance.com>
Subject: Re: [PATCH-next] mm/memcontrol.c: Fix potential uninitialized variable warning
Date: Wed, 26 May 2021 13:43:21 -0700	[thread overview]
Message-ID: <20210526134321.42bbd4a9dcbcf53e855c5b1b@linux-foundation.org> (raw)
In-Reply-To: <20210526193602.8742-1-longman@redhat.com>

On Wed, 26 May 2021 15:36:02 -0400 Waiman Long <longman@redhat.com> wrote:

> If the -Wno-maybe-uninitialized gcc option is not specified, compilation
> of memcontrol.c may generate the following warnings:
> 
> mm/memcontrol.c: In function ‘refill_obj_stock’:
> ./arch/x86/include/asm/irqflags.h:127:17: warning: ‘flags’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>   return !(flags & X86_EFLAGS_IF);
>           ~~~~~~~^~~~~~~~~~~~~~~~
> mm/memcontrol.c:3216:16: note: ‘flags’ was declared here
>   unsigned long flags;
>                 ^~~~~
> In file included from mm/memcontrol.c:29:
> mm/memcontrol.c: In function ‘uncharge_page’:
> ./include/linux/memcontrol.h:797:2: warning: ‘objcg’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>   percpu_ref_put(&objcg->refcnt);
>   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Fix that by properly initializing *pflags in get_obj_stock() and
> introducing a use_objcg bool variable in uncharge_page() to avoid
> potentially accessing the struct page data twice.
> 

Thanks.  I'll queue this as a fix against your "mm/memcg: optimize user
context object stock access".



  reply	other threads:[~2021-05-26 20:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-26 19:36 Waiman Long
2021-05-26 20:43 ` Andrew Morton [this message]
2021-05-26 22:29   ` Waiman Long

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=20210526134321.42bbd4a9dcbcf53e855c5b1b@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=longman@redhat.com \
    --cc=mhocko@kernel.org \
    --cc=songmuchun@bytedance.com \
    --cc=vdavydov.dev@gmail.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