Thread (14 messages) 14 messages, 7 authors, 2024-03-06

Re: [PATCH] netdev: Use flexible array for trailing private bytes

From: Alexander Lobakin <aleksander.lobakin@intel.com>
Date: 2024-03-04 14:35:34
Also in: linux-hardening, lkml

From: Jakub Kicinski <kuba@kernel.org>
Date: Fri, 1 Mar 2024 09:35:17 -0800
On Fri, 1 Mar 2024 15:30:03 +0100 Alexander Lobakin wrote:
quoted
I like the idea of declaring priv explicitly rather than doing size +
ptr magic. But maybe we could just add this flex array to struct
net_device and avoid introducing a new structure.
100% I should have linked to the thread that led to Kees's work.
Adding directly to net_device would be way better but there's
a handful of drivers which embed the struct.
I think it's okay to embed a struct with flex array at the end as long
as it's not used? Or the compiler will say that the flex array is not at
the end of the structure?
If we can switch them to dynamic allocation, that'd be great.
It's mega weird to embed &net_device rather than do alloc_*dev() >_<
And, as you may be alluding to, it removes the need for the WARN_ON()
entirely as well.
Thanks,
Olek
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help