From patchwork Thu Nov 13 11:44:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 410385 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C918D140079 for ; Thu, 13 Nov 2014 22:47:27 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xospq-0002fn-Ia; Thu, 13 Nov 2014 11:45:10 +0000 Received: from foss-mx-na.foss.arm.com ([217.140.108.86]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xospa-0002G8-Rh for linux-arm-kernel@lists.infradead.org; Thu, 13 Nov 2014 11:44:56 +0000 Received: from foss-smtp-na-1.foss.arm.com (unknown [10.80.61.8]) by foss-mx-na.foss.arm.com (Postfix) with ESMTP id EBB4A66; Thu, 13 Nov 2014 05:44:20 -0600 (CST) Received: from collaborate-mta1.arm.com (highbank-bc01-b06.austin.arm.com [10.112.81.134]) by foss-smtp-na-1.foss.arm.com (Postfix) with ESMTP id 7284B5FAD7; Thu, 13 Nov 2014 05:44:18 -0600 (CST) Received: from arm.com (edgewater-inn.cambridge.arm.com [10.1.203.36]) by collaborate-mta1.arm.com (Postfix) with ESMTPS id C436413F78C; Thu, 13 Nov 2014 05:44:17 -0600 (CST) Date: Thu, 13 Nov 2014 11:44:20 +0000 From: Will Deacon To: Geoff Levand Subject: Re: [PATCH] efi: Fix free_end build warning Message-ID: <20141113114420.GF13350@arm.com> References: <1415824050.15847.9.camel@smoke> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1415824050.15847.9.camel@smoke> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141113_034454_903908_1ACA1783 X-CRM114-Status: GOOD ( 15.81 ) X-Spam-Score: -0.6 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record Cc: Catalin Marinas , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org Hi Geoff, On Wed, Nov 12, 2014 at 08:27:30PM +0000, Geoff Levand wrote: > Initialize the free_end variable to zero. Fixes build warnings > like these: > > arch/arm64/kernel/efi.c: warning: ‘free_end’ may be used uninitialized in this function > > Signed-off-by: Geoff Levand > --- > Got this with the latest arm64/for-next/core branch. Please consider. > > -Geoff > > arch/arm64/kernel/efi.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c > index 4f39a18..83fc53c 100644 > --- a/arch/arm64/kernel/efi.c > +++ b/arch/arm64/kernel/efi.c > @@ -239,6 +239,7 @@ static void __init free_boot_services(void) > * want to keep for UEFI. > */ > > + free_end = 0; > keep_end = 0; > free_start = 0; Do you have any idea how GCC arrives at this conclusion? I can't see a path through that function where we use free_end without initialising it. Does something like the patch below help? Will --->8 diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index 95c49ebc660d..4c577b538d1c 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -271,17 +271,16 @@ static void __init free_boot_services(void) size = npages << PAGE_SHIFT; if (free_start) { - if (paddr <= free_end) - free_end = paddr + size; - else { + if (paddr > free_end) { total_freed += free_region(free_start, free_end); free_start = paddr; - free_end = paddr + size; } } else { free_start = paddr; - free_end = paddr + size; } + + free_end = paddr + size; + if (free_start < keep_end) { free_start += PAGE_SIZE; if (free_start >= free_end)