[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20130621140908.GP6492@oc6784271780.ibm.com>
Date: Fri, 21 Jun 2013 09:09:08 -0500
From: "Philip J. Kelleher" <pjk1939@...ux.vnet.ibm.com>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Joshua Morris <josh.h.morris@...ibm.com>,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [patch] rsxx: returning bytes remaining instead of -EFAULT
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@...cle.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.
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists