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

[Xen-changelog] [xen stable-4.7] tools/libxc/xc_dom_arm: add missing variable initialization



commit df0949d197cc753871f5df1a0358b43edd2fd365
Author:     Bernd Kuhls <bernd.kuhls@xxxxxxxxxxx>
AuthorDate: Sat Aug 19 16:21:42 2017 +0200
Commit:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
CommitDate: Tue Oct 17 13:09:51 2017 -0700

    tools/libxc/xc_dom_arm: add missing variable initialization
    
    The variable domctl.u.address_size.size may remain uninitialized if
    guest_type is not one of xen-3.0-aarch64 or xen-3.0-armv7l. And the
    code precisely checks if this variable is still 0 to decide if the
    guest type is supported or not.
    
    This fixes the following build failure with gcc 7.x:
    
    xc_dom_arm.c:229:31: error: 'domctl.u.address_size.size' may be used 
uninitialized in this function [-Werror=maybe-uninitialized]
         if ( domctl.u.address_size.size == 0 )
    
    Patch originally taken from
    https://www.mail-archive.com/xen-devel@xxxxxxxxxxxxx/msg109313.html.
    
    Signed-off-by: Bernd Kuhls <bernd.kuhls@xxxxxxxxxxx>
    Signed-off-by: Thomas Petazzoni <thomas.petazzoni@xxxxxxxxxxxxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    (cherry picked from commit 88bfbf90e35f1213f9967a97dee0b2039f9998a4)
---
 tools/libxc/xc_dom_arm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c
index 64a8b67..ce15a07 100644
--- a/tools/libxc/xc_dom_arm.c
+++ b/tools/libxc/xc_dom_arm.c
@@ -222,6 +222,8 @@ static int set_mode(xc_interface *xch, domid_t domid, char 
*guest_type)
 
     domctl.domain = domid;
     domctl.cmd    = XEN_DOMCTL_set_address_size;
+    domctl.u.address_size.size = 0;
+
     for ( i = 0; i < ARRAY_SIZE(types); i++ )
         if ( !strcmp(types[i].guest, guest_type) )
             domctl.u.address_size.size = types[i].size;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.7

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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