From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Dan Carpenter <error27@gmail.com>
Cc: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>,
kernel-janitors@vger.kernel.org, xen-devel@lists.xensource.com,
virtualization@lists.linux-foundation.org
Subject: Re: [patch 1/2] xen-gntdev: return -EFAULT on copy_to_user failure
Date: Fri, 25 Mar 2011 11:04:38 -0400 [thread overview]
Message-ID: <20110325150438.GG27651@dumpdata.com> (raw)
In-Reply-To: <20110319054434.GD2008@bicker>
On Sat, Mar 19, 2011 at 08:44:34AM +0300, Dan Carpenter wrote:
> copy_to_user() returns the amount of data remaining to be copied. We
> want to return a negative error code here. The upper layers just
> call WARN_ON() if we return non-zero so this doesn't change the
> behavior. But returning -EFAULT is still cleaner.
Thank you. Will put it on rc1 train.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
>
> diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
> index 017ce60..b0f9e8f 100644
> --- a/drivers/xen/gntdev.c
> +++ b/drivers/xen/gntdev.c
> @@ -273,7 +273,7 @@ static int __unmap_grant_pages(struct grant_map *map, int offset, int pages)
> map->vma->vm_start + map->notify.addr;
> err = copy_to_user(tmp, &err, 1);
> if (err)
> - return err;
> + return -EFAULT;
> map->notify.flags &= ~UNMAP_NOTIFY_CLEAR_BYTE;
> } else if (pgno >= offset && pgno < offset + pages) {
> uint8_t *tmp = kmap(map->pages[pgno]);
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
prev parent reply other threads:[~2011-03-25 15:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-19 5:44 [patch 1/2] xen-gntdev: return -EFAULT on copy_to_user failure Dan Carpenter
2011-03-25 15:04 ` Konrad Rzeszutek Wilk [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=20110325150438.GG27651@dumpdata.com \
--to=konrad.wilk@oracle.com \
--cc=error27@gmail.com \
--cc=jeremy.fitzhardinge@citrix.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=xen-devel@lists.xensource.com \
/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;
as well as URLs for NNTP newsgroup(s).