Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756698AbdLPMYF (ORCPT ); Sat, 16 Dec 2017 07:24:05 -0500 Received: from mail-oi0-f66.google.com ([209.85.218.66]:37556 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752535AbdLPMYE (ORCPT ); Sat, 16 Dec 2017 07:24:04 -0500 X-Google-Smtp-Source: ACJfBovl4zsQYyZddhJkILi6xgxuiCdxVggUAe9PUC6PbZVEnIQ2lWkZJflUA+rgBHlgNJSBVulpXMx73vmLQD83IyM= MIME-Version: 1.0 In-Reply-To: <8d5476e2-5f87-1134-62d4-9f649c4e709a@alibaba-inc.com> References: <20171215125129.2948634-1-arnd@arndb.de> <8d5476e2-5f87-1134-62d4-9f649c4e709a@alibaba-inc.com> From: Arnd Bergmann Date: Sat, 16 Dec 2017 13:24:02 +0100 X-Google-Sender-Auth: E6OXgGkcdjR-iOXMZuKrugqU4lY Message-ID: Subject: Re: [PATCH] mm: thp: avoid uninitialized variable use To: Yang Shi Cc: Andrew Morton , Michal Hocko , "Kirill A. Shutemov" , Stephen Rothwell , Vlastimil Babka , David Rientjes , Ingo Molnar , Linux-MM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1027 Lines: 29 On Fri, Dec 15, 2017 at 7:01 PM, Yang Shi 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. 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