From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751151AbeAVU6i (ORCPT ); Mon, 22 Jan 2018 15:58:38 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:52886 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750942AbeAVU6h (ORCPT ); Mon, 22 Jan 2018 15:58:37 -0500 Date: Mon, 22 Jan 2018 12:58:36 -0800 From: Andrew Morton To: jglisse@redhat.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ralph Campbell Subject: Re: [PATCH] mm/hmm: fix uninitialized use of 'entry' in hmm_vma_walk_pmd() Message-Id: <20180122125836.1aebb001d4c2c4e93029db35@linux-foundation.org> In-Reply-To: <20180122185759.26286-1-jglisse@redhat.com> References: <20180122185759.26286-1-jglisse@redhat.com> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 22 Jan 2018 13:57:59 -0500 jglisse@redhat.com wrote: > From: Ralph Campbell > > The variable 'entry' is used before being initialized in > hmm_vma_walk_pmd() > > ... > > --- a/mm/hmm.c > +++ b/mm/hmm.c > @@ -418,7 +418,7 @@ static int hmm_vma_walk_pmd(pmd_t *pmdp, > } > > if (!pte_present(pte)) { > - swp_entry_t entry; > + swp_entry_t entry = pte_to_swp_entry(pte); > > if (!non_swap_entry(entry)) { > if (hmm_vma_walk->fault) > @@ -426,8 +426,6 @@ static int hmm_vma_walk_pmd(pmd_t *pmdp, > continue; > } > > - entry = pte_to_swp_entry(pte); > - > /* > * This is a special swap entry, ignore migration, use > * device and report anything else as error. Gee, how did that sneak through. gcc not clever enough... I'll add a cc:stable to this, even though the changelog didn't tell us what the runtime effects of the bug are. It should do so, so can you please send us that description and I will add it, thanks.