From dae65190174ee1c861303f5e205acc11266c4cbd Mon Sep 17 00:00:00 2001 From: Swapnil Ingle Date: Mon, 2 Sep 2019 06:01:50 -0400 Subject: 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 --- kmod/muser.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'kmod') 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; -- cgit v1.1