netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: Kuniyuki Iwashima <kuniyu@amazon.com>
Cc: alexander@mihalicyn.com, ast@kernel.org, davem@davemloft.net,
	dhowells@redhat.com, edumazet@google.com, kernelxing@tencent.com,
	kuba@kernel.org, leit@meta.com, linux-kernel@vger.kernel.org,
	lucien.xin@gmail.com, martin.lau@kernel.org,
	netdev@vger.kernel.org, pabeni@redhat.com
Subject: Re: [PATCH net-next] net: Use _K_SS_MAXSIZE instead of absolute value
Date: Wed, 19 Jul 2023 10:18:49 -0700	[thread overview]
Message-ID: <ZLga+cBUKkN5Fnn7@gmail.com> (raw)
In-Reply-To: <20230719170445.30993-1-kuniyu@amazon.com>

On Wed, Jul 19, 2023 at 10:04:45AM -0700, Kuniyuki Iwashima wrote:
> From: Breno Leitao <leitao@debian.org>
> Date: Wed, 19 Jul 2023 01:44:12 -0700
> > Looking at sk_getsockopt function, it is unclear why 128 is a magical
> > number.
> > 
> > Use the proper macro, so it becomes clear to understand what the value
> > mean, and get a reference where it is coming from (user-exported API).
> > 
> > Signed-off-by: Breno Leitao <leitao@debian.org>
> > ---
> >  net/core/sock.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/net/core/sock.c b/net/core/sock.c
> > index 9370fd50aa2c..58b6f00197d6 100644
> > --- a/net/core/sock.c
> > +++ b/net/core/sock.c
> > @@ -1815,7 +1815,7 @@ int sk_getsockopt(struct sock *sk, int level, int optname,
> >  
> >  	case SO_PEERNAME:
> >  	{
> > -		char address[128];
> > +		char address[_K_SS_MAXSIZE];
> 
> I guess you saw a bug caught by the fortified memcpy(), but this
> doesn't fix it properly.

Not really, in fact. I was reading this code, and I found this
discussion a while ago, where I got the idea:

https://lore.kernel.org/lkml/20140930.005925.995989898229686123.davem@davemloft.net/

  reply	other threads:[~2023-07-19 17:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-19  8:44 [PATCH net-next] net: Use _K_SS_MAXSIZE instead of absolute value Breno Leitao
2023-07-19 17:04 ` Kuniyuki Iwashima
2023-07-19 17:18   ` Breno Leitao [this message]
2023-07-19 17:30     ` Kuniyuki Iwashima
2023-07-20  9:29       ` Breno Leitao

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=ZLga+cBUKkN5Fnn7@gmail.com \
    --to=leitao@debian.org \
    --cc=alexander@mihalicyn.com \
    --cc=ast@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=edumazet@google.com \
    --cc=kernelxing@tencent.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@amazon.com \
    --cc=leit@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=martin.lau@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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).