Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

xen/pci: Avoid -Wflex-array-member-not-at-end warning

Use the `DEFINE_RAW_FLEX()` helper for an on-stack definition of
a flexible structure where the size of the flexible-array member
is known at compile-time, and refactor the rest of the code,
accordingly.

So, with this, fix the following warning:

drivers/xen/pci.c:48:55: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Kees Cook <kees@kernel.org>
Message-ID: <ZsU58MvoYEEqBHZl@elsanto>
Signed-off-by: Juergen Gross <jgross@suse.com>

authored by

Gustavo A. R. Silva and committed by
Juergen Gross
a8d0b5eb 3adc73ef

+5 -9
+5 -9
drivers/xen/pci.c
··· 44 44 } 45 45 #endif 46 46 if (pci_seg_supported) { 47 - struct { 48 - struct physdev_pci_device_add add; 49 - uint32_t pxm; 50 - } add_ext = { 51 - .add.seg = pci_domain_nr(pci_dev->bus), 52 - .add.bus = pci_dev->bus->number, 53 - .add.devfn = pci_dev->devfn 54 - }; 55 - struct physdev_pci_device_add *add = &add_ext.add; 47 + DEFINE_RAW_FLEX(struct physdev_pci_device_add, add, optarr, 1); 48 + 49 + add->seg = pci_domain_nr(pci_dev->bus); 50 + add->bus = pci_dev->bus->number; 51 + add->devfn = pci_dev->devfn; 56 52 57 53 #ifdef CONFIG_ACPI 58 54 acpi_handle handle;