From: Richard Cochran <richardcochran@gmail.com>
To: Dan Carpenter <error27@gmail.com>
Cc: Richard Cochran <richard.cochran@omicron.at>,
"David S. Miller" <davem@davemloft.net>,
John Stultz <john.stultz@linaro.org>,
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: Mon, 30 May 2011 06:12:38 +0000 [thread overview]
Message-ID: <20110530061237.GA3166@riccoc20.at.omicron.at> (raw)
In-Reply-To: <20110529195312.GA3099@shale.localdomain>
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?)
Thanks,
Richard
next prev parent reply other threads:[~2011-05-30 6:12 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 [this message]
2011-06-01 6:46 ` John Stultz
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=20110530061237.GA3166@riccoc20.at.omicron.at \
--to=richardcochran@gmail.com \
--cc=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=error27@gmail.com \
--cc=john.stultz@linaro.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=richard.cochran@omicron.at \
--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