From: "Philip J. Kelleher" <pjk1939@linux.vnet.ibm.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Joshua Morris <josh.h.morris@us.ibm.com>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] rsxx: returning bytes remaining instead of -EFAULT
Date: Fri, 21 Jun 2013 09:09:08 -0500 [thread overview]
Message-ID: <20130621140908.GP6492@oc6784271780.ibm.com> (raw)
In-Reply-To: <20130621062111.GC10873@elgon.mountain>
On Fri, Jun 21, 2013 at 09:21:11AM +0300, Dan Carpenter wrote:
> copy_to/from_user() returns the number of bytes remaining to be copied.
> We should return -EFAULT here instead.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c
> index 6e85e21..102dc60 100644
> --- a/drivers/block/rsxx/core.c
> +++ b/drivers/block/rsxx/core.c
> @@ -199,9 +199,8 @@ static ssize_t rsxx_cram_read(struct file *fp, char __user *ubuf,
> if (st)
> return st;
>
> - st = copy_to_user(ubuf, buf, cnt);
> - if (st)
> - return st;
> + if (copy_to_user(ubuf, buf, cnt))
> + return -EFAULT;
>
> info->offset += cnt;
>
> @@ -222,9 +221,8 @@ static ssize_t rsxx_cram_write(struct file *fp, const char __user *ubuf,
> if (!buf)
> return -ENOMEM;
>
> - st = copy_from_user(buf, ubuf, cnt);
> - if (st)
> - return st;
> + if (copy_from_user(buf, ubuf, cnt))
> + return -EFAULT;
>
> info->f_pos = (u32)*ppos + info->offset;
Thank You for noticing that mistake on my part.
>
>
prev parent reply other threads:[~2013-06-21 14:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-21 6:21 Dan Carpenter
2013-06-21 14:09 ` Philip J. Kelleher [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=20130621140908.GP6492@oc6784271780.ibm.com \
--to=pjk1939@linux.vnet.ibm.com \
--cc=dan.carpenter@oracle.com \
--cc=josh.h.morris@us.ibm.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®