* [PATCH v20 net] net: pppoe: avoid zero-length arrays in struct pppoe_hdr
@ 2026-02-24 15:50 Eric Woudstra
2026-02-24 22:09 ` Florian Westphal
2026-02-26 3:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 4+ messages in thread
From: Eric Woudstra @ 2026-02-24 15:50 UTC (permalink / raw)
To: Michal Ostrowski, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: netdev, Florian Westphal, Eric Woudstra, Nikolay Aleksandrov,
Kees Cook
Jakub Kicinski suggested following patch:
W=1 C=1 GCC build gives us:
net/bridge/netfilter/nf_conntrack_bridge.c: note: in included file (through
../include/linux/if_pppox.h, ../include/uapi/linux/netfilter_bridge.h,
../include/linux/netfilter_bridge.h): include/uapi/linux/if_pppox.h:
153:29: warning: array of flexible structures
It doesn't like that hdr has a zero-length array which overlaps proto.
The kernel code doesn't currently need those arrays.
PPPoE connection is functional after applying this patch.
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Reviewed-by: Kees Cook <kees@kernel.org>
Signed-off-by: Eric Woudstra <ericwouds@gmail.com>
---
This version was last send in:
[PATCH v19 nf-next 1/5] net: pppoe: avoid zero-length arrays in
struct pppoe_hdr
Although it is needed to prevent warnings caused by my patches send to
nf-next, it was asked to send this patch separately to netdev.
drivers/net/ppp/pppoe.c | 2 +-
include/uapi/linux/if_pppox.h | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
index 4275b393a454..7900cc3212a5 100644
--- a/drivers/net/ppp/pppoe.c
+++ b/drivers/net/ppp/pppoe.c
@@ -885,7 +885,7 @@ static int pppoe_sendmsg(struct socket *sock, struct msghdr *m,
skb->protocol = cpu_to_be16(ETH_P_PPP_SES);
ph = skb_put(skb, total_len + sizeof(struct pppoe_hdr));
- start = (char *)&ph->tag[0];
+ start = (char *)ph + sizeof(*ph);
error = memcpy_from_msg(start, m, total_len);
if (error < 0) {
diff --git a/include/uapi/linux/if_pppox.h b/include/uapi/linux/if_pppox.h
index 9abd80dcc46f..29b804aa7474 100644
--- a/include/uapi/linux/if_pppox.h
+++ b/include/uapi/linux/if_pppox.h
@@ -122,7 +122,9 @@ struct sockaddr_pppol2tpv3in6 {
struct pppoe_tag {
__be16 tag_type;
__be16 tag_len;
+#ifndef __KERNEL__
char tag_data[];
+#endif
} __attribute__ ((packed));
/* Tag identifiers */
@@ -150,7 +152,9 @@ struct pppoe_hdr {
__u8 code;
__be16 sid;
__be16 length;
+#ifndef __KERNEL__
struct pppoe_tag tag[];
+#endif
} __packed;
/* Length of entire PPPoE + PPP header */
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v20 net] net: pppoe: avoid zero-length arrays in struct pppoe_hdr
2026-02-24 15:50 [PATCH v20 net] net: pppoe: avoid zero-length arrays in struct pppoe_hdr Eric Woudstra
@ 2026-02-24 22:09 ` Florian Westphal
2026-02-26 3:26 ` Jakub Kicinski
2026-02-26 3:40 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 4+ messages in thread
From: Florian Westphal @ 2026-02-24 22:09 UTC (permalink / raw)
To: Eric Woudstra
Cc: Michal Ostrowski, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev, Nikolay Aleksandrov,
Kees Cook
Eric Woudstra <ericwouds@gmail.com> wrote:
> Although it is needed to prevent warnings caused by my patches send to
> nf-next, it was asked to send this patch separately to netdev.
Yes, thanks for doing that. While I occasionally do send non-nf patches
in pull requests, thats usually restricted to very small functional
dependencies, e.g. a new EXPORT_SYMBOL().
Dave/Eric D/Paolo/Jakub - this change can be applied to either net or
net-next; it avoids W=1 spew with patches under discussion on nf-next.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v20 net] net: pppoe: avoid zero-length arrays in struct pppoe_hdr
2026-02-24 22:09 ` Florian Westphal
@ 2026-02-26 3:26 ` Jakub Kicinski
0 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2026-02-26 3:26 UTC (permalink / raw)
To: Florian Westphal
Cc: Eric Woudstra, Michal Ostrowski, Andrew Lunn, David S. Miller,
Eric Dumazet, Paolo Abeni, netdev, Nikolay Aleksandrov, Kees Cook
On Tue, 24 Feb 2026 23:09:06 +0100 Florian Westphal wrote:
> Eric Woudstra <ericwouds@gmail.com> wrote:
> > Although it is needed to prevent warnings caused by my patches send to
> > nf-next, it was asked to send this patch separately to netdev.
>
> Yes, thanks for doing that. While I occasionally do send non-nf patches
> in pull requests, thats usually restricted to very small functional
> dependencies, e.g. a new EXPORT_SYMBOL().
Yup
> Dave/Eric D/Paolo/Jakub - this change can be applied to either net or
> net-next; it avoids W=1 spew with patches under discussion on nf-next.
I went with net-next.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v20 net] net: pppoe: avoid zero-length arrays in struct pppoe_hdr
2026-02-24 15:50 [PATCH v20 net] net: pppoe: avoid zero-length arrays in struct pppoe_hdr Eric Woudstra
2026-02-24 22:09 ` Florian Westphal
@ 2026-02-26 3:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-02-26 3:40 UTC (permalink / raw)
To: Eric Woudstra
Cc: mostrows, andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
fw, razor, kees
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 24 Feb 2026 16:50:30 +0100 you wrote:
> Jakub Kicinski suggested following patch:
>
> W=1 C=1 GCC build gives us:
>
> net/bridge/netfilter/nf_conntrack_bridge.c: note: in included file (through
> ../include/linux/if_pppox.h, ../include/uapi/linux/netfilter_bridge.h,
> ../include/linux/netfilter_bridge.h): include/uapi/linux/if_pppox.h:
> 153:29: warning: array of flexible structures
>
> [...]
Here is the summary with links:
- [v20,net] net: pppoe: avoid zero-length arrays in struct pppoe_hdr
https://git.kernel.org/netdev/net-next/c/7717fbb14028
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-02-26 3:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-24 15:50 [PATCH v20 net] net: pppoe: avoid zero-length arrays in struct pppoe_hdr Eric Woudstra
2026-02-24 22:09 ` Florian Westphal
2026-02-26 3:26 ` Jakub Kicinski
2026-02-26 3:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox