From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [patch 3/3] vfio: return -EFAULT on failure
Date: Thu, 28 Jun 2012 09:45:26 +0300 [thread overview]
Message-ID: <20120628064524.GC11107@elgon.mountain> (raw)
In-Reply-To: <1340686552.1207.128.camel@bling.home>
This ioctl function is supposed to return a negative error code or zero
on success. copy_to_user() returns zero or the number of bytes
remaining to be copied.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index 457acf3..1aa373f 100644
--- a/drivers/vfio/vfio.c
+++ b/drivers/vfio/vfio.c
@@ -1159,6 +1159,8 @@ static long vfio_group_fops_unl_ioctl(struct file *filep,
status.flags |= VFIO_GROUP_FLAGS_CONTAINER_SET;
ret = copy_to_user((void __user *)arg, &status, minsz);
+ if (ret)
+ ret = -EFAULT;
break;
}
next prev parent reply other threads:[~2012-06-28 6:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-26 4:55 Request VFIO inclusion in linux-next Alex Williamson
2012-06-26 23:50 ` Stephen Rothwell
[not found] ` <1340686552.1207.128.camel-xdHQ/5r00wBBDLzU/O5InQ@public.gmane.org>
2012-06-26 21:17 ` Benjamin Herrenschmidt
2012-06-27 12:37 ` Dan Carpenter
2012-06-27 19:23 ` Alex Williamson
[not found] ` <1340825003.1207.224.camel-xdHQ/5r00wBBDLzU/O5InQ@public.gmane.org>
2012-06-28 6:44 ` Dan Carpenter
2012-07-02 3:41 ` Alexey Kardashevskiy
[not found] ` <4FF11855.2060605-sLpHqDYs0B2HXe+LvDLADg@public.gmane.org>
2012-07-02 4:14 ` Alex Williamson
2012-06-28 6:44 ` [patch 1/3] vfio: signedness bug in vfio_config_do_rw() Dan Carpenter
2012-06-28 6:44 ` [patch 2/3] vfio: make count unsigned to prevent integer underflow Dan Carpenter
2012-06-28 22:24 ` Alex Williamson
2012-06-28 6:45 ` Dan Carpenter [this message]
2012-06-28 22:25 ` [patch 3/3] vfio: return -EFAULT on failure Alex Williamson
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=20120628064524.GC11107@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=alex.williamson@redhat.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kvm@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