From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5F5D52094560A for ; Tue, 11 Jul 2017 10:32:18 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1AE7D30AF44; Tue, 11 Jul 2017 17:34:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1AE7D30AF44 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lersek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 1AE7D30AF44 Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-201.phx2.redhat.com [10.3.116.201]) by smtp.corp.redhat.com (Postfix) with ESMTP id DCB0F7F1D5; Tue, 11 Jul 2017 17:34:01 +0000 (UTC) To: Brijesh Singh , edk2-devel@lists.01.org Cc: Jordan Justen References: <1499792934-9258-1-git-send-email-brijesh.singh@amd.com> From: Laszlo Ersek Message-ID: <3b31ba2f-04ba-1aa1-5baf-d2a13d3570b8@redhat.com> Date: Tue, 11 Jul 2017 19:34:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1499792934-9258-1-git-send-email-brijesh.singh@amd.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 11 Jul 2017 17:34:04 +0000 (UTC) Subject: Re: [PATCH 1/1] OvmfPkg/QemuFwCfgLib: Suppress GCC49 IA32 build failure X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 17:32:18 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Hi Brijesh, On 07/11/17 19:08, Brijesh Singh wrote: > NumPages variable was introduced in commit 66c548be509d. In this commit > we allocate an intermediate buffer when SEV is enabled. The 'BounceBuffer' > variable points to the intermediate buffer pointer and NumPages variables > stores the number of pages. Later in the code, 'BounceBuffer' variable is > checked to see if we need to free the intermediate buffers. The code looks > correct, suppress the warning. > > Cc: Jordan Justen > Cc: Laszlo Ersek > Reported-by: Laszlo Ersek > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Brijesh Singh > --- > OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c > index dbebd36b1853..1b21ef094dc5 100644 > --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c > +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c > @@ -72,7 +72,7 @@ InternalQemuFwCfgDmaBytes ( > volatile FW_CFG_DMA_ACCESS *Access; > UINT32 AccessHigh, AccessLow; > UINT32 Status; > - UINT32 NumPages; > + UINT32 NumPages = 0; > VOID *DmaBuffer, *BounceBuffer; > > ASSERT (Control == FW_CFG_DMA_CTL_WRITE || Control == FW_CFG_DMA_CTL_READ || > In edk2 we don't initialize local variables in the ISO C sense of "initialization" -- please use a separate assignment, plus add a code comment like mentioned here: https://bugzilla.tianocore.org/show_bug.cgi?id=607 Other than that, I agree that NumPages cannot be used without setting it first. The only such path through the code would be if InternalQemuFwCfgSevIsEnabled() returned FALSE. However, in that case, BounceBuffer is set to NULL, and the final use of NumPages (on line 168) is never reached. Thank you, Laszlo