[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 1/1] hvm.c: Prevent gcc uninitialised var warning



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 <murrayie@xxxxxxxxxxx>
Signed-off-by: Don Slutz <dslutz@xxxxxxxxxxx>
---

Here is the patch for:

In-Reply-To: 
<A3CD31A5D207064088A18AC2AF7B5DC6C27A1E9F@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
References: <9AAE0902D5BC7E449B7C8E4E778ABCD0258434BF@xxxxxxxxxxxxxxxxxxxxxxxx>
             <887729013.1172497.1426540794859.JavaMail.yahoo@xxxxxxxxxxxxxx>
              
<A3CD31A5D207064088A18AC2AF7B5DC6C27A1E9F@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
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


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.