Skip to contentSkip to conversation

tools/libxc/xc_dom_arm: add missing variable initialization

PATCH In review Thomas Petazzoni 3 participants 3 messages Aug 19, 2017 – Sep 14, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/libxc/xc_dom_arm: add missing variable initialization

From: Bernd Kuhls <[email protected]>

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/[email protected]/msg109313.html.

---
 tools/libxc/xc_dom_arm.c | 2 ++
 1 file changed, 2 insertions(+)
tools/libxc/xc_dom_arm.c +2 -0
index e7d4bd0..e669fb0 100644
@@ -223,6 +223,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;
Signature · 7 lines
2.9.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Thomas Petazzoni

From: Bernd Kuhls <[email protected]>

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:

Quoted 8 lines

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/[email protected]/msg109313.html.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
Quoted 13 lines · Wei Liu
Quoted 12 lines · Thomas Petazzoni

From: Bernd Kuhls <[email protected]>

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 )
Quoted 8 lines
Quoted 5 lines

Patch originally taken from
https://www.mail-archive.com/[email protected]/msg109313.html.

Please can this patch be backported / cherry-picked into Xen 4.9.

commit 88bfbf90e35f1213f9967a97dee0b2039f9998a4

thanks

Christopher

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel