Skip to content

Commit a8d0b5e

Browse files
GustavoARSilvajgross1
authored andcommitted
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 <[email protected]> Reviewed-by: Kees Cook <[email protected]> Message-ID: <ZsU58MvoYEEqBHZl@elsanto> Signed-off-by: Juergen Gross <[email protected]>
1 parent 3adc73e commit a8d0b5e

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

drivers/xen/pci.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,11 @@ static int xen_add_device(struct device *dev)
4444
}
4545
#endif
4646
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;
5652

5753
#ifdef CONFIG_ACPI
5854
acpi_handle handle;

0 commit comments

Comments
 (0)