linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Hugh Dickins <hughd@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Andreas Gruenbacher <agruenba@redhat.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] shmem: avoid maybe-uninitialized warning
Date: Mon, 24 Oct 2016 22:32:18 +0200	[thread overview]
Message-ID: <20161024203218.GF13148@dhcp22.suse.cz> (raw)
In-Reply-To: <4142781.4gMiS9Brv9@wuerfel>

On Mon 24-10-16 21:42:36, Arnd Bergmann wrote:
> On Monday, October 24, 2016 6:22:44 PM CEST Michal Hocko wrote:
> > On Mon 24-10-16 17:25:03, Arnd Bergmann wrote:
> > > After enabling -Wmaybe-uninitialized warnings, we get a false-postive
> > > warning for shmem:
> > > 
> > > mm/shmem.c: In function a??shmem_getpage_gfpa??:
> > > include/linux/spinlock.h:332:21: error: a??infoa?? may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > 
> > Is this really a false positive? If we goto clear and then 
> >         if (sgp <= SGP_CACHE &&
> >             ((loff_t)index << PAGE_SHIFT) >= i_size_read(inode)) {
> >                 if (alloced) {
> > 
> > we could really take a spinlock on an unitialized variable. But maybe
> > there is something that prevents from that...
> 
> I did the patch a few weeks ago (I sent the more important
> ones out first) and I think I concluded then that 'alloced'
> would be false in that case.

OK, I guess you are right and alloced is set only after info has been
already initialized. So this really looks like a false positive.

> 
> > Anyway the whole shmem_getpage_gfp is really hard to follow due to gotos
> > and labels proliferation.
> 
> Exactly. Maybe we should mark the patch for -stable backports after all
> just to be sure.

I am not really sure a stable backport is really necessary but a cleanup
in this area would be more than welcome. At least from me ;)
-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2016-10-24 20:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-24 15:25 [PATCH] shmem: avoid maybe-uninitialized warning Arnd Bergmann
2016-10-24 16:22 ` Michal Hocko
2016-10-24 19:42   ` Arnd Bergmann
2016-10-24 20:32     ` Michal Hocko [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=20161024203218.GF13148@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=agruenba@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=hughd@google.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=vbabka@suse.cz \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).