netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <willemdebruijn.kernel@gmail.com>
Cc: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<kuni1840@gmail.com>, <kuniyu@amazon.com>, <leitao@debian.org>,
	<netdev@vger.kernel.org>, <pabeni@redhat.com>
Subject: Re: [PATCH v1 net-next] net: Use sockaddr_storage for getsockopt(SO_PEERNAME).
Date: Thu, 20 Jul 2023 09:32:43 -0700	[thread overview]
Message-ID: <20230720163243.640-1-kuniyu@amazon.com> (raw)
In-Reply-To: <64b93bb6d30dd_2ad92129482@willemb.c.googlers.com.notmuch>

From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
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/20230720004410.87588-1-kuniyu@amazon.com/
> > Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
> 
> Reviewed-by: Willem de Bruijn <willemb@google.com>

      reply	other threads:[~2023-07-20 16:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-20  0:54 [PATCH v1 net-next] net: Use sockaddr_storage for getsockopt(SO_PEERNAME) Kuniyuki Iwashima
2023-07-20  5:01 ` Eric Dumazet
2023-07-20 13:50 ` Willem de Bruijn
2023-07-20 16:32   ` Kuniyuki Iwashima [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230720163243.640-1-kuniyu@amazon.com \
    --to=kuniyu@amazon.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=kuni1840@gmail.com \
    --cc=leitao@debian.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=willemdebruijn.kernel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).