diff mbox

staging aarch64 build fails in xc_dom_arm.c

Message ID 7ec75007-2067-8c71-625c-b22ba5f0f0d9@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrew Cooper May 30, 2017, 3:34 p.m. UTC
On 30/05/17 16:27, Olaf Hering wrote:
> 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

             domctl.u.address_size.size = types[i].size;

help?

~Andrew

Comments

Olaf Hering May 30, 2017, 3:40 p.m. UTC | #1
On Tue, May 30, Andrew Cooper wrote:

> 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
Andrew Cooper May 30, 2017, 3:43 p.m. UTC | #2
On 30/05/17 16:40, Olaf Hering wrote:
> On Tue, May 30, Andrew Cooper wrote:
>
>> 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
diff mbox

Patch

diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c
index e7d4bd0..e669fb0 100644
--- a/tools/libxc/xc_dom_arm.c
+++ b/tools/libxc/xc_dom_arm.c
@@ -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) )