summaryrefslogtreecommitdiffstats
path: root/include/net/phonet
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2019-02-19 22:53:50 +0100
committerDavid S. Miller <davem@davemloft.net>2019-02-22 01:23:56 +0100
commit6321aa197547da397753757bd84c6ce64b3e3d89 (patch)
tree74697a2e39836b2675d3998b2e7d071d001f381f /include/net/phonet
parentMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klasse... (diff)
downloadlinux-6321aa197547da397753757bd84c6ce64b3e3d89.tar.xz
linux-6321aa197547da397753757bd84c6ce64b3e3d89.zip
phonet: fix building with clang
clang warns about overflowing the data[] member in the struct pnpipehdr: net/phonet/pep.c:295:8: warning: array index 4 is past the end of the array (which contains 1 element) [-Warray-bounds] if (hdr->data[4] == PEP_IND_READY) ^ ~ include/net/phonet/pep.h:66:3: note: array 'data' declared here u8 data[1]; Using a flexible array member at the end of the struct avoids the warning, but since we cannot have a flexible array member inside of the union, each index now has to be moved back by one, which makes it a little uglier. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: RĂ©mi Denis-Courmont <remi@remlab.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/phonet')
-rw-r--r--include/net/phonet/pep.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/net/phonet/pep.h b/include/net/phonet/pep.h
index b669fe6dbc3b..98f31c7ea23d 100644
--- a/include/net/phonet/pep.h
+++ b/include/net/phonet/pep.h
@@ -63,10 +63,11 @@ struct pnpipehdr {
u8 state_after_reset; /* reset request */
u8 error_code; /* any response */
u8 pep_type; /* status indication */
- u8 data[1];
+ u8 data0; /* anything else */
};
+ u8 data[];
};
-#define other_pep_type data[1]
+#define other_pep_type data[0]
static inline struct pnpipehdr *pnp_hdr(struct sk_buff *skb)
{