0003-tools-libxc-xc_dom_arm-add-missing-variable-initiali.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. From d4eece000391583a6e32a225d7eb5b573a5c5565 Mon Sep 17 00:00:00 2001
  2. From: Bernd Kuhls <bernd.kuhls@t-online.de>
  3. Date: Sat, 19 Aug 2017 15:22:58 +0200
  4. Subject: [PATCH] tools/libxc/xc_dom_arm: add missing variable initialization
  5. The variable domctl.u.address_size.size may remain uninitialized if
  6. guest_type is not one of xen-3.0-aarch64 or xen-3.0-armv7l. And the
  7. code precisely checks if this variable is still 0 to decide if the
  8. guest type is supported or not.
  9. This fixes the following build failure with gcc 7.x:
  10. xc_dom_arm.c:229:31: error: 'domctl.u.address_size.size' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  11. if ( domctl.u.address_size.size == 0 )
  12. Patch originally taken from
  13. https://www.mail-archive.com/xen-devel@lists.xen.org/msg109313.html.
  14. Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
  15. [Thomas: improved commit log, reformatted with Git.]
  16. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  17. ---
  18. tools/libxc/xc_dom_arm.c | 2 ++
  19. 1 file changed, 2 insertions(+)
  20. diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c
  21. index e7d4bd0..e669fb0 100644
  22. --- a/tools/libxc/xc_dom_arm.c
  23. +++ b/tools/libxc/xc_dom_arm.c
  24. @@ -223,6 +223,8 @@ static int set_mode(xc_interface *xch, domid_t domid, char *guest_type)
  25. domctl.domain = domid;
  26. domctl.cmd = XEN_DOMCTL_set_address_size;
  27. + domctl.u.address_size.size = 0;
  28. +
  29. for ( i = 0; i < ARRAY_SIZE(types); i++ )
  30. if ( !strcmp(types[i].guest, guest_type) )
  31. domctl.u.address_size.size = types[i].size;
  32. --
  33. 2.9.4