public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: John Stultz <john.stultz@linaro.org>
To: Richard Cochran <richardcochran@gmail.com>
Cc: Dan Carpenter <error27@gmail.com>,
	Richard Cochran <richard.cochran@omicron.at>,
	"David S. Miller" <davem@davemloft.net>,
	Arnd Bergmann <arnd@arndb.de>,
	open list <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [patch 1/2] ptp: return -EFAULT on copy_to_user() errors
Date: Tue, 31 May 2011 23:46:20 -0700	[thread overview]
Message-ID: <1306910780.3359.53.camel@work-vm> (raw)
In-Reply-To: <20110530061237.GA3166@riccoc20.at.omicron.at>

On Mon, 2011-05-30 at 08:12 +0200, Richard Cochran wrote:
> On Sun, May 29, 2011 at 10:53:12PM +0300, Dan Carpenter wrote:
> > copy_to_user() returns the number of bytes remaining, but we want a
> > negative error code here.
> > 
> > Signed-off-by: Dan Carpenter <error27@gmail.com>
> > 
> > diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
> > index a8d03ae..93fa22d 100644
> > --- a/drivers/ptp/ptp_chardev.c
> > +++ b/drivers/ptp/ptp_chardev.c
> > @@ -46,7 +46,8 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
> >  		caps.n_ext_ts = ptp->info->n_ext_ts;
> >  		caps.n_per_out = ptp->info->n_per_out;
> >  		caps.pps = ptp->info->pps;
> > -		err = copy_to_user((void __user *)arg, &caps, sizeof(caps));
> > +		if (copy_to_user((void __user *)arg, &caps, sizeof(caps)))
> > +			err = -EFAULT;
> 
> Yes, right, and thanks for the extra review.
> 
> Thomas, can you please queue these two patches for 3.0-rc2?
> 
> (Or should John Stultz handle this sort of thing?)

Queued in my tree.

Richard, Since you like these, do you mind formally acking them so I can
add that?

thanks
-john



  reply	other threads:[~2011-06-01  6:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-29 19:53 [patch 1/2] ptp: return -EFAULT on copy_to_user() errors Dan Carpenter
2011-05-30  6:12 ` Richard Cochran
2011-06-01  6:46   ` John Stultz [this message]
2011-06-01 10:16     ` Richard Cochran

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=1306910780.3359.53.camel@work-vm \
    --to=john.stultz@linaro.org \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=error27@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richard.cochran@omicron.at \
    --cc=richardcochran@gmail.com \
    --cc=tglx@linutronix.de \
    /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