msm: mink: Accept zero args for invoke command

Currently, INVOKE IOCTL assumes presence of atleast one arg. This
assumption is not correct. Hence, adding support for zero args in
INVOKE IOCTL.

Change-Id: Ib44789559c69e5808ed362cf9191486c93b2b66e
Signed-off-by: Dinesh K Garg <dineshg@codeaurora.org>
This commit is contained in:
Dinesh K Garg 2016-09-21 09:37:40 -07:00
parent 9e2d528dc4
commit 9f18e779e6

View file

@ -375,23 +375,27 @@ long smcinvoke_ioctl(struct file *filp, unsigned cmd, unsigned long arg)
nr_args = object_counts_num_buffers(req.counts) +
object_counts_num_objects(req.counts);
if (!nr_args || req.argsize != sizeof(union smcinvoke_arg)) {
if (req.argsize != sizeof(union smcinvoke_arg)) {
ret = -EINVAL;
goto out;
}
args_buf = kzalloc(nr_args * req.argsize, GFP_KERNEL);
if (!args_buf) {
ret = -ENOMEM;
goto out;
}
if (nr_args) {
ret = copy_from_user(args_buf, (void __user *)(req.args),
args_buf = kzalloc(nr_args * req.argsize, GFP_KERNEL);
if (!args_buf) {
ret = -ENOMEM;
goto out;
}
ret = copy_from_user(args_buf,
(void __user *)(req.args),
nr_args * req.argsize);
if (ret) {
ret = -EFAULT;
goto out;
if (ret) {
ret = -EFAULT;
goto out;
}
}
inmsg_size = compute_in_msg_size(&req, args_buf);