From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756731AbcARXDa (ORCPT ); Mon, 18 Jan 2016 18:03:30 -0500 Received: from mail-wm0-f46.google.com ([74.125.82.46]:38397 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755517AbcARXD1 (ORCPT ); Mon, 18 Jan 2016 18:03:27 -0500 Date: Tue, 19 Jan 2016 01:03:24 +0200 From: "Kirill A. Shutemov" To: Arnd Bergmann , Andrew Morton Cc: Ebru Akagunduz , dan.carpenter@oracle.com, linux-mm@kvack.org, Linus Torvalds , "Kirill A. Shutemov" , Rik van Riel , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] mm: avoid uninitialized variable in tracepoint Message-ID: <20160118230324.GF14531@node.shutemov.name> References: <4117363.Ys1FTDH7Wz@wuerfel> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4117363.Ys1FTDH7Wz@wuerfel> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 18, 2016 at 09:50:26PM +0100, Arnd Bergmann wrote: > A newly added tracepoint in the hugepage code uses a variable in the > error handling that is not initialized at that point: > > include/trace/events/huge_memory.h:81:230: error: 'isolated' may be used uninitialized in this function [-Werror=maybe-uninitialized] > > The result is relatively harmless, as the trace data will in rare > cases contain incorrect data. > > This works around the problem by adding an explicit initialization. > > Signed-off-by: Arnd Bergmann > Fixes: 7d2eba0557c1 ("mm: add tracepoint for scanning pages") There's the same patch in mm tree, but it got lost on the way to Linus' tree: https://ozlabs.org/~akpm/mmots/broken-out/mm-make-optimistic-check-for-swapin-readahead-fix.patch Andrew? > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > index b2db98136af9..bb3b763b1829 100644 > --- a/mm/huge_memory.c > +++ b/mm/huge_memory.c > @@ -2320,7 +2320,7 @@ static void collapse_huge_page(struct mm_struct *mm, > pgtable_t pgtable; > struct page *new_page; > spinlock_t *pmd_ptl, *pte_ptl; > - int isolated, result = 0; > + int isolated = 0, result = 0; > unsigned long hstart, hend; > struct mem_cgroup *memcg; > unsigned long mmun_start; /* For mmu_notifiers */ > -- Kirill A. Shutemov