Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:olh:xen-4.9
xen
xen.d25cc3ec93ebda030349045d2c7fa14ffde07ed7.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File xen.d25cc3ec93ebda030349045d2c7fa14ffde07ed7.patch of Package xen
From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= <marmarek@invisiblethingslab.com> Date: Wed, 19 Aug 2020 04:00:35 +0200 Subject: d25cc3ec93ebda030349045d2c7fa14ffde07ed7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit libxl: workaround gcc 10.2 maybe-uninitialized warning It seems xlu_pci_parse_bdf has a state machine that is too complex for gcc to understand. The build fails with: libxlu_pci.c: In function 'xlu_pci_parse_bdf': libxlu_pci.c:32:18: error: 'func' may be used uninitialized in this function [-Werror=maybe-uninitialized] 32 | pcidev->func = func; | ~~~~~~~~~~~~~^~~~~~ libxlu_pci.c:51:29: note: 'func' was declared here 51 | unsigned dom, bus, dev, func, vslot = 0; | ^~~~ libxlu_pci.c:31:17: error: 'dev' may be used uninitialized in this function [-Werror=maybe-uninitialized] 31 | pcidev->dev = dev; | ~~~~~~~~~~~~^~~~~ libxlu_pci.c:51:24: note: 'dev' was declared here 51 | unsigned dom, bus, dev, func, vslot = 0; | ^~~ libxlu_pci.c:30:17: error: 'bus' may be used uninitialized in this function [-Werror=maybe-uninitialized] 30 | pcidev->bus = bus; | ~~~~~~~~~~~~^~~~~ libxlu_pci.c:51:19: note: 'bus' was declared here 51 | unsigned dom, bus, dev, func, vslot = 0; | ^~~ libxlu_pci.c:29:20: error: 'dom' may be used uninitialized in this function [-Werror=maybe-uninitialized] 29 | pcidev->domain = domain; | ~~~~~~~~~~~~~~~^~~~~~~~ libxlu_pci.c:51:14: note: 'dom' was declared here 51 | unsigned dom, bus, dev, func, vslot = 0; | ^~~ cc1: all warnings being treated as errors Workaround it by setting the initial value to invalid value (0xffffffff) and then assert on each value being set. This way we mute the gcc warning, while still detecting bugs in the parse code. Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com> Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com> --- tools/libxl/libxlu_pci.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/tools/libxl/libxlu_pci.c +++ b/tools/libxl/libxlu_pci.c @@ -36,28 +36,29 @@ static int pcidev_struct_fill(libxl_device_pci *pcidev, unsigned int domain, #define STATE_DOMAIN 0 #define STATE_BUS 1 #define STATE_DEV 2 #define STATE_FUNC 3 #define STATE_VSLOT 4 #define STATE_OPTIONS_K 6 #define STATE_OPTIONS_V 7 #define STATE_TERMINAL 8 #define STATE_TYPE 9 #define STATE_RDM_STRATEGY 10 #define STATE_RESERVE_POLICY 11 +#define INVALID 0xffffffff int xlu_pci_parse_bdf(XLU_Config *cfg, libxl_device_pci *pcidev, const char *str) { unsigned state = STATE_DOMAIN; - unsigned dom, bus, dev, func, vslot = 0; + unsigned dom = INVALID, bus = INVALID, dev = INVALID, func = INVALID, vslot = 0; char *buf2, *tok, *ptr, *end, *optkey = NULL; if ( NULL == (buf2 = ptr = strdup(str)) ) return ERROR_NOMEM; for(tok = ptr, end = ptr + strlen(ptr) + 1; ptr < end; ptr++) { switch(state) { case STATE_DOMAIN: if ( *ptr == ':' ) { state = STATE_BUS; *ptr = '\0'; if ( hex_convert(tok, &dom, 0xffff) ) @@ -161,24 +162,26 @@ int xlu_pci_parse_bdf(XLU_Config *cfg, libxl_device_pci *pcidev, const char *str XLU__PCI_ERR(cfg, "Unknown PCI BDF option: %s", optkey); } tok = ptr + 1; } default: break; } } if ( tok != ptr || state != STATE_TERMINAL ) goto parse_error; + assert(dom != INVALID && bus != INVALID && dev != INVALID && func != INVALID); + /* Just a pretty way to fill in the values */ pcidev_struct_fill(pcidev, dom, bus, dev, func, vslot << 3); free(buf2); return 0; parse_error: free(buf2); return ERROR_INVAL; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor