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

2024-03-01 Thread Eric Dumazet
On Fri, Mar 1, 2024 at 7:59 AM Jakub Kicinski wrote: > > On Thu, 29 Feb 2024 13:30:22 -0800 Kees Cook wrote: > > diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h > > index 118c40258d07..b476809d0bae 100644 > > --- a/include/linux/netdevice.h > > +++ b/include/linux/netdevice.h >

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

2024-03-01 Thread Eric Dumazet
On Fri, Mar 1, 2024 at 1:59 PM Alexander Lobakin wrote: > > From: Eric Dumazet > Date: Fri, 1 Mar 2024 09:03:55 +0100 > > > On Fri, Mar 1, 2024 at 7:59 AM Jakub Kicinski wrote: > >> > >> On Thu, 29 Feb 2024 13:30:22 -0800 Kees Cook wrote: > > Re WARN

Re: [PATCH net-next] netdevice: define and allocate &net_device _properly_

2024-05-07 Thread Eric Dumazet
On Tue, May 7, 2024 at 2:40 PM Alexander Lobakin wrote: > > In fact, this structure contains a flexible array at the end, but > historically its size, alignment etc., is calculated manually. > There are several instances of the structure embedded into other > structures, but also there's ongoing e

Re: [PATCH net-next v2] netdevice: define and allocate &net_device _properly_

2024-07-09 Thread Eric Dumazet
riv_len); > +} cacheline_aligned; > #define to_net_dev(d) container_of(d, struct net_device, dev) > > /* > @@ -2596,7 +2599,7 @@ void dev_net_set(struct net_device *dev, struct net > *net) > */ > static inline void *netdev_priv(const struct net_device *dev) > { > - return (char *)dev + ALIGN(sizeof(struct net_device), NETDEV_ALIGN); > + return (void *)dev->priv; Minor remark : the cast is not needed, but this is fine. Reviewed-by: Eric Dumazet It would be great to get rid of NETDEV_ALIGN eventually. Thanks.

Re: [PATCH net-next v2] netdevice: define and allocate &net_device _properly_

2024-07-10 Thread Eric Dumazet
On Wed, Jul 10, 2024 at 4:19 AM Breno Leitao wrote: > > Hello Eric, > > On Tue, Jul 09, 2024 at 08:27:45AM -0700, Eric Dumazet wrote: > > On Tue, Jul 9, 2024 at 5:54 AM Breno Leitao wrote: > > > > @@ -2596,7 +2599,7 @@ void dev_net_set(struct net_devic

Re: [PATCH net-next v2] netdevice: define and allocate &net_device _properly_

2024-07-11 Thread Eric Dumazet
On Thu, Jul 11, 2024 at 5:54 AM Alexander Lobakin wrote: > > From: Eric Dumazet > Date: Wed, 10 Jul 2024 10:04:39 -0700 > > > This is because of the ‘const’ qualifier of the parameter. > > > > This could be solved with _Generic() later, if we want to keep the &g

Re: [PATCH] net/ipv4: Replace tcp_ca_get_name_by_key()'s strncpy() with strscpy()

2024-07-11 Thread Eric Dumazet
a pointer, the size can't be > trivially determined by the compiler. ca->name is the same length, > so strscpy() won't fail (when ca->name is NUL-terminated). Include the > length explicitly instead of using the 2-argument strscpy(). > > Link: https://github.com/KSPP/linux

Re: [PATCH v2] net/ipv4/tcp_cong: Replace strncpy() with strscpy()

2024-07-16 Thread Eric Dumazet
; > > > Subject: [PATCH net-next v2] tcp: ... > > > > That notwithstanding, this looks good to me. > > > > Reviewed-by: Simon Horman > > @Eric: I can fix the prefix when applying the patch. Please LMK if you > prefer otherwise. Sure thing, thanks for taking care of this Paolo, Simon, and Kees. Reviewed-by: Eric Dumazet

Re: [PATCH RFC 3/5] rtnetlink: do_setlink: Use sockaddr_storage

2024-11-05 Thread Eric Dumazet
On 11/4/24 11:25 PM, Kees Cook wrote: Instead of a heap allocation use a stack allocated sockaddr_storage to support arbitrary length addr_len value (but bounds check it against the maximum address length). Signed-off-by: Kees Cook --- net/core/rtnetlink.c | 12 1 file changed