Skip to content

Commit f4ab186

Browse files
Zhang Kunboandreas-gaisler
authored andcommitted
sparc: replace zero-length array with flexible-array member
The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array member[1], introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last, which is beneficial to cultivate a high-quality code.[2] This issue was found with the help of Coccinelle. [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] commit 7649773 ("cxgb3/l2t: Fix undefined behaviour") Signed-off-by: Zhang Kunbo <[email protected]> Reviewed-by: Andreas Larsson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Andreas Larsson <[email protected]>
1 parent 929bd2a commit f4ab186

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/sparc/kernel/pci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@ static void pci_bus_slot_names(struct device_node *node, struct pci_bus *bus)
932932
{
933933
const struct pci_slot_names {
934934
u32 slot_mask;
935-
char names[0];
935+
char names[];
936936
} *prop;
937937
const char *sp;
938938
int len, i;

0 commit comments

Comments
 (0)