From: Don Slutz Subject: [PATCH 1/1] hvm.c: Prevent gcc uninitialised var warning Date: Mon, 23 Mar 2015 10:01:28 -0400 Message-ID: <1427119288-19348-1-git-send-email-dslutz@verizon.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Keir Fraser , Ian Campbell , Ian Murray , Andrew Cooper , Don Slutz , Jan Beulich List-Id: xen-devel@lists.xenproject.org gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 reports: ---------------------------------------------------------------------- hvm.c: In function `hvm_create_ioreq_server': hvm.c:487:18: error: `bufioreq_pfn' may be used uninitialised in this function [-Werror=uninitialized] hvm.c:718:30: note: `bufioreq_pfn' was declared here ---------------------------------------------------------------------- My code analysis says that gcc is wrong, but initilize the variable to prevent the gcc warning. Reported-by: Ian Murray Signed-off-by: Don Slutz --- Here is the patch for: In-Reply-To: References: <9AAE0902D5BC7E449B7C8E4E778ABCD0258434BF@AMSPEX01CL01.citrite.net> <887729013.1172497.1426540794859.JavaMail.yahoo@mail.yahoo.com> Subject: Re: [Xen-devel] Compliling Xen 4.5.0 Fails with error: =?UTF-8?Q?=E2=80=98bufioreq=5Fpfn=E2=80=99?= may be used uninitialised in this function [-Werror=uninitialized] xen/arch/x86/hvm/hvm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 4734d71..dd6b0d0 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -733,7 +733,8 @@ static int hvm_ioreq_server_map_pages(struct hvm_ioreq_server *s, bool_t is_default, bool_t handle_bufioreq) { struct domain *d = s->domain; - unsigned long ioreq_pfn, bufioreq_pfn; + unsigned long ioreq_pfn; + unsigned long bufioreq_pfn = ~0UL; /* gcc uninitialised var warning */ int rc; if ( is_default ) -- 1.8.4