Subject: Re: [PATCH v1 net-next] net: Use sockaddr_storage for getsockopt(SO_PEERNAME).

From: Kuniyuki Iwashima <[email-masked]>
Date: Thu, 20 Jul 2023 09:32:43 -0700

From: Willem de Bruijn <[email-masked]>
Date: Thu, 20 Jul 2023 09:50:46 -0400
> Kuniyuki Iwashima wrote:
> > Commit df8fc4e934c1 ("kbuild: Enable -fstrict-flex-arrays=3") started
> > applying strict rules to standard string functions.
> > 
> > It does not work well with conventional socket code around each protocol-
> > specific struct sockaddr_XXX, which is cast from sockaddr_storage and has
> > a bigger size than fortified functions expect.  (See Link)
> > 
> > We must cast the protocol-specific address back to sockaddr_storage
> > to call such functions.
> > 
> > However, in the case of getsockaddr(SO_PEERNAME), the rationale is a bit
> > unclear as the buffer is defined by char[128] which is the same size as
> > sockaddr_storage.
> > 
> > Let's use sockaddr_storage implicitly.
> 
> explicitly

Will fix in v2, thanks!

>  
> > Link: https://lore.kernel.org/netdev/[email-masked]/
> > Signed-off-by: Kuniyuki Iwashima <[email-masked]>
> 
> Reviewed-by: Willem de Bruijn <[email-masked]>