[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iLmNtDp7gK2xo_znvh+9-JUyNAW7E2xieLkpBMth96DBw@mail.gmail.com>
Date: Thu, 20 Jul 2023 07:01:20 +0200
From: Eric Dumazet <edumazet@...gle.com>
To: Kuniyuki Iwashima <kuniyu@...zon.com>
Cc: "David S. Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Willem de Bruijn <willemdebruijn.kernel@...il.com>,
Breno Leitao <leitao@...ian.org>, Kuniyuki Iwashima <kuni1840@...il.com>, netdev@...r.kernel.org
Subject: Re: [PATCH v1 net-next] net: Use sockaddr_storage for getsockopt(SO_PEERNAME).
On Thu, Jul 20, 2023 at 2:55 AM Kuniyuki Iwashima <kuniyu@...zon.com> 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.
>
> Link: https://lore.kernel.org/netdev/20230720004410.87588-1-kuniyu@amazon.com/
> Signed-off-by: Kuniyuki Iwashima <kuniyu@...zon.com>
Reviewed-by: Eric Dumazet <edumazet@...gle.com>
Thanks.
Powered by blists - more mailing lists