From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751685AbdAYPso (ORCPT ); Wed, 25 Jan 2017 10:48:44 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:33358 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750875AbdAYPsn (ORCPT ); Wed, 25 Jan 2017 10:48:43 -0500 Date: Wed, 25 Jan 2017 23:48:38 +0800 From: Wei Yang To: Arnd Bergmann Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Denys Vlasenko , Wei Yang , Dan Williams , Toshi Kani , linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/e820: fix e820_search_gap() error handling on x86-32 Message-ID: <20170125154838.GA8355@WeideMacBook-Pro.local> Reply-To: Wei Yang References: <20170111144926.695369-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170111144926.695369-1-arnd@arndb.de> User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org You are right. Thanks :-) On Wed, Jan 11, 2017 at 03:49:04PM +0100, Arnd Bergmann wrote: >gcc correctly points out that on 32-bit kernels, e820_search_gap() >not finding a start now leads to pci_mem_start being set to an >uninitialized value: > >arch/x86/kernel/e820.c: In function 'e820_setup_gap': >arch/x86/kernel/e820.c:641:16: error: 'gapstart' may be used uninitialized in this function [-Werror=maybe-uninitialized] > >This restores the behavior from before the cleanup, defaulting >to address 0x10000000 if nothing was found. > >Fixes: b4ed1d15b453 ("x86/e820: Make e820_search_gap() static and remove unused variables") >Signed-off-by: Arnd Bergmann >--- > arch/x86/kernel/e820.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > >diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c >index 46f2afd3577a..b2bbad6ebe4d 100644 >--- a/arch/x86/kernel/e820.c >+++ b/arch/x86/kernel/e820.c >@@ -626,14 +626,16 @@ __init void e820_setup_gap(void) > gapsize = 0x400000; > found = e820_search_gap(&gapstart, &gapsize); > >-#ifdef CONFIG_X86_64 > if (!found) { >+#ifdef CONFIG_X86_64 > gapstart = (max_pfn << PAGE_SHIFT) + 1024*1024; > printk(KERN_ERR > "e820: cannot find a gap in the 32bit address range\n" > "e820: PCI devices with unassigned 32bit BARs may break!\n"); >- } >+#else >+ gapstart = 0x10000000; > #endif >+ } > > /* > * e820_reserve_resources_late protect stolen RAM already >-- >2.9.0 -- Wei Yang Help you, Help me