Skip to contentSkip to conversation

staging aarch64 build fails in xc_dom_arm.c

DISCUSSION Olaf Hering 2 participants 4 messages May 30, 2017

lore
Share & tools
lore
#0 lore raw

With gcc7 the aarch64 build in staging fails:

xc_dom_arm.c: In function 'meminit':
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 )
           ~~~~~~~~~~~~~~~~~~~~~^~~~~

Olaf

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

#1 lore raw
Quoted 6 lines · Olaf Hering

With gcc7 the aarch64 build in staging fails:

xc_dom_arm.c: In function 'meminit':
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 )
           ~~~~~~~~~~~~~~~~~~~~~^~~~~

That's because it really will be uninitialised if the caller passes anything other than "xen-3.0-aarch64" or "xen-3.0-armv7l" into guest type.

Does

tools/libxc/xc_dom_arm.c +0 -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;

help?

~Andrew

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

#2 lore raw
Quoted 3 lines · Andrew Cooper

Does
+ domctl.u.address_size.size = 0;
help?

Likely yes. I just scanned the buildlogs and found this failure.
I do not have a ARM toolchain around to double check.
Not sure why the marco, or its usage, is not like 'struct xen_domctl domctl = {}'

Olaf

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

#3 lore raw
Quoted 8 lines · Olaf Hering
Quoted 3 lines · Andrew Cooper

Does
+ domctl.u.address_size.size = 0;
help?

Likely yes. I just scanned the buildlogs and found this failure.
I do not have a ARM toolchain around to double check.
Not sure why the marco, or its usage, is not like 'struct xen_domctl domctl = {}'

I've never been convinced by the utility of those macros. All they do is make it cognitively harder to read the code.

I think I even tried to kill them once, but got nacked.

Either way, my position still stands that they should be relegated to /dev/null and we pretend that they never existed.

~Andrew

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