aboutsummaryrefslogtreecommitdiff
path: root/kmod
diff options
context:
space:
mode:
authorSwapnil Ingle <swapnil.ingle@nutanix.com>2019-09-02 06:01:50 -0400
committerFelipe Franciosi <felipe@nutanix.com>2019-09-05 16:45:35 +0100
commitdae65190174ee1c861303f5e205acc11266c4cbd (patch)
treeee02ededadd87ecdf1ff5199378c870db2e57c79 /kmod
parent5f573729efd3d3aa7c63c7715f461c832559395f (diff)
downloadlibvfio-user-dae65190174ee1c861303f5e205acc11266c4cbd.zip
libvfio-user-dae65190174ee1c861303f5e205acc11266c4cbd.tar.gz
libvfio-user-dae65190174ee1c861303f5e205acc11266c4cbd.tar.bz2
muser, libmuser: make libmuser_{read,write} consistent
Currently muser/libmuser_write() expects mucmd as buffer, while muser/libmuser_read() expects data buffer. We arleady have the mucmd in mudev->pending, so make muser/libmuser_write() to take data buffer instead of mucmd. This way libmuser_{read,write} are consistent and we do not use mucmd sent by user. Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Diffstat (limited to 'kmod')
-rw-r--r--kmod/muser.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/kmod/muser.c b/kmod/muser.c
index 95c1a05..7463441 100644
--- a/kmod/muser.c
+++ b/kmod/muser.c
@@ -1716,7 +1716,6 @@ static ssize_t libmuser_write(struct file *filp, const char __user *buf,
{
struct muser_dev *mudev = filp->private_data;
struct mudev_cmd *mucmd = mudev->mucmd_pending;
- struct muser_cmd muser_cmd;
unsigned int seek;
int ret;
@@ -1732,22 +1731,7 @@ static ssize_t libmuser_write(struct file *filp, const char __user *buf,
switch (mucmd->type) {
case MUSER_READ:
- ret = muser_copyin(&muser_cmd, (void __user *)buf,
- sizeof(struct muser_cmd));
- if (ret)
- return ret;
-
- /*
- * TODO: libmuser must not encapsulate buf in muser_cmd instead
- * it must just call write() with buf.
- */
-
- if (mucmd->type != muser_cmd.type) {
- muser_dbg("bad command %d", muser_cmd.type);
- return -EINVAL;
- }
-
- ret = bounce_in(mucmd, muser_cmd.rw.buf);
+ ret = bounce_in(mucmd, (void __user *)buf);
if (ret)
return ret;
break;