Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 10e06b94 authored by Dinesh K Garg's avatar Dinesh K Garg
Browse files

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: default avatarDinesh K Garg <dineshg@codeaurora.org>
parent ea7861da
Loading
Loading
Loading
Loading
+14 −10
Original line number Diff line number Diff line
@@ -383,24 +383,28 @@ 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;
		}

		if (nr_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),
			ret = copy_from_user(args_buf,
						(void __user *)(req.args),
						nr_args * req.argsize);

			if (ret) {
				ret = -EFAULT;
				goto out;
			}
		}

		inmsg_size = compute_in_msg_size(&req, args_buf);
		in_msg = (void *)__get_free_pages(GFP_KERNEL,
+5 −5
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ struct smcinvoke_cmd_req {
	uint32_t counts;
	int32_t	result;
	uint32_t argsize;
	uint64_t __user args;
	uint64_t args;
};

#define SMCINVOKE_IOC_MAGIC    0x98