public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Dave Watson <davejwatson@fb.com>,
	Aviad Yehezkel <aviadye@mellanox.com>,
	Ilya Lesokhin <ilyal@mellanox.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH -net] tls: return -EFAULT if copy_to_user() fails
Date: Fri, 23 Jun 2017 03:58:35 -0700	[thread overview]
Message-ID: <1498215515.24295.12.camel@perches.com> (raw)
In-Reply-To: <20170623103612.ycduw43oyi6hmtp3@mwanda>

On Fri, 2017-06-23 at 13:36 +0300, Dan Carpenter wrote:
> On Fri, Jun 23, 2017 at 03:31:44AM -0700, Joe Perches wrote:
> > On Fri, 2017-06-23 at 13:15 +0300, Dan Carpenter wrote:
> > > The copy_to_user() function returns the number of bytes remaining but we
> > > want to return -EFAULT here.
> > 
> > because?
> > 
> 
> Rhetorical questions don't work over email.  Are you honestly confused
> by this patch?

There doesn't seem to be a fault here, just a
return of less than the expected number of bytes.

It's non-obvious why -EFAULT is the appropriate
return value.

Why is changing the return value from number of
bytes transferred, even if less than desired,
the right thing to do?  Your commit message
doesn't describe any rationale.

getsockopt says:

For getsockopt(), optlen is a value-result argument, initially containing the size
of the buffer pointed to by optval, and modified on return to indicate the actual
size of the value returned

The generic EFAULT description in getsockopt is:

       EFAULT    The  address  pointed  to by optval is not in a valid part of the
                 process address space.  For getsockopt(), this error may also  be
                 returned  if optlen is not in a valid part of the process address
                 space.

Is tls different?




  reply	other threads:[~2017-06-23 10:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-23 10:15 [PATCH -net] tls: return -EFAULT if copy_to_user() fails Dan Carpenter
2017-06-23 10:31 ` Joe Perches
2017-06-23 10:34   ` Dan Carpenter
2017-06-23 10:36   ` Dan Carpenter
2017-06-23 10:58     ` Joe Perches [this message]
2017-06-23 11:29       ` Dan Carpenter
2017-06-23 16:12 ` Dave Watson
2017-06-23 18:20 ` David Miller

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=1498215515.24295.12.camel@perches.com \
    --to=joe@perches.com \
    --cc=aviadye@mellanox.com \
    --cc=dan.carpenter@oracle.com \
    --cc=davejwatson@fb.com \
    --cc=davem@davemloft.net \
    --cc=ilyal@mellanox.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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