All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yang Shi" <yang.s@alibaba-inc.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Michal Hocko <mhocko@suse.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Vlastimil Babka <vbabka@suse.cz>,
	David Rientjes <rientjes@google.com>,
	Ingo Molnar <mingo@kernel.org>, Linux-MM <linux-mm@kvack.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: thp: avoid uninitialized variable use
Date: Sun, 17 Dec 2017 06:25:17 +0800	[thread overview]
Message-ID: <63b69d2b-1c1d-6f08-30a6-e996b6842000@alibaba-inc.com> (raw)
In-Reply-To: <CAK8P3a3arg08JuBrz+Pqa47xsFCHtxTJ+7ywepeJpJro02NEjg@mail.gmail.com>



On 12/16/17 4:24 AM, Arnd Bergmann wrote:
> On Fri, Dec 15, 2017 at 7:01 PM, Yang Shi <yang.s@alibaba-inc.com> wrote:
>>
>>
>> On 12/15/17 4:51 AM, Arnd Bergmann wrote:
>>>
>>> When the down_read_trylock() fails, 'vma' has not been initialized
>>> yet, which gcc now warns about:
>>>
>>> mm/khugepaged.c: In function 'khugepaged':
>>> mm/khugepaged.c:1659:25: error: 'vma' may be used uninitialized in this
>>> function [-Werror=maybe-uninitialized]
>>
>>
>> Arnd,
>>
>> Thanks for catching this. I'm wondering why my test didn't catch it. It
>> might be because my gcc is old. I'm using gcc 4.8.5 on centos 7.
> 
> Correct, gcc-4.8 and earlier have too many false-positive warnings with
> -Wmaybe-uninitialized, so we turn it off on those versions. 4.9 is much
> better here, but I'd recommend using gcc-6 or gcc-7 when you upgrade,
> they have a much better set of default warnings besides producing better
> binary code.

Thanks, I just upgraded gcc to 6.4 on my cetnos 7 machine. But, I ran 
into a build error with 4.15-rc3 kernel, but 4.14 is fine. I bisected to 
a commit in Makefile. I will email my bug report to the mailing list.

Regards,
Yang

> 
> See http://git.infradead.org/users/segher/buildall.git for a simple way
> to build toolchains suitable for building kernels in varying architectures
> and versions.
> 
>         Arnd
> 

WARNING: multiple messages have this Message-ID (diff)
From: "Yang Shi" <yang.s@alibaba-inc.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Michal Hocko <mhocko@suse.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Vlastimil Babka <vbabka@suse.cz>,
	David Rientjes <rientjes@google.com>,
	Ingo Molnar <mingo@kernel.org>, Linux-MM <linux-mm@kvack.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: thp: avoid uninitialized variable use
Date: Sun, 17 Dec 2017 06:25:17 +0800	[thread overview]
Message-ID: <63b69d2b-1c1d-6f08-30a6-e996b6842000@alibaba-inc.com> (raw)
In-Reply-To: <CAK8P3a3arg08JuBrz+Pqa47xsFCHtxTJ+7ywepeJpJro02NEjg@mail.gmail.com>



On 12/16/17 4:24 AM, Arnd Bergmann wrote:
> On Fri, Dec 15, 2017 at 7:01 PM, Yang Shi <yang.s@alibaba-inc.com> wrote:
>>
>>
>> On 12/15/17 4:51 AM, Arnd Bergmann wrote:
>>>
>>> When the down_read_trylock() fails, 'vma' has not been initialized
>>> yet, which gcc now warns about:
>>>
>>> mm/khugepaged.c: In function 'khugepaged':
>>> mm/khugepaged.c:1659:25: error: 'vma' may be used uninitialized in this
>>> function [-Werror=maybe-uninitialized]
>>
>>
>> Arnd,
>>
>> Thanks for catching this. I'm wondering why my test didn't catch it. It
>> might be because my gcc is old. I'm using gcc 4.8.5 on centos 7.
> 
> Correct, gcc-4.8 and earlier have too many false-positive warnings with
> -Wmaybe-uninitialized, so we turn it off on those versions. 4.9 is much
> better here, but I'd recommend using gcc-6 or gcc-7 when you upgrade,
> they have a much better set of default warnings besides producing better
> binary code.

Thanks, I just upgraded gcc to 6.4 on my cetnos 7 machine. But, I ran 
into a build error with 4.15-rc3 kernel, but 4.14 is fine. I bisected to 
a commit in Makefile. I will email my bug report to the mailing list.

Regards,
Yang

> 
> See http://git.infradead.org/users/segher/buildall.git for a simple way
> to build toolchains suitable for building kernels in varying architectures
> and versions.
> 
>         Arnd
> 

--
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:[~2017-12-16 22:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-15 12:51 [PATCH] mm: thp: avoid uninitialized variable use Arnd Bergmann
2017-12-15 12:51 ` Arnd Bergmann
2017-12-15 13:03 ` Michal Hocko
2017-12-15 13:03   ` Michal Hocko
2017-12-15 18:01 ` Yang Shi
2017-12-15 18:01   ` Yang Shi
2017-12-16 12:24   ` Arnd Bergmann
2017-12-16 12:24     ` Arnd Bergmann
2017-12-16 22:25     ` Yang Shi [this message]
2017-12-16 22:25       ` Yang Shi

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=63b69d2b-1c1d-6f08-30a6-e996b6842000@alibaba-inc.com \
    --to=yang.s@alibaba-inc.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=mingo@kernel.org \
    --cc=rientjes@google.com \
    --cc=sfr@canb.auug.org.au \
    --cc=vbabka@suse.cz \
    /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.