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

Commit f806d62b authored by suchawla's avatar suchawla Committed by Gerrit - the friendly Code Review server
Browse files

msm: cvp: Allocating karg dynamically



To fix stack frame size issue, Allocating karg
from heap.

Change-Id: I1d3a40ed4b24dae13eabeb6aa69567126d29e031
Signed-off-by: default avatarsuchawla <suchawla@codeaurora.org>
parent 1b0d1533
Loading
Loading
Loading
Loading
+15 −9
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
 */

#include "msm_v4l2_private.h"
@@ -612,34 +612,40 @@ static long cvp_ioctl(struct msm_cvp_inst *inst,
	unsigned int cmd, unsigned long arg)
{
	int rc;
	struct cvp_kmd_arg karg;
	struct cvp_kmd_arg *karg;

	if (!inst) {
		dprintk(CVP_ERR, "%s: invalid params\n", __func__);
		return -EINVAL;
	}

	memset(&karg, 0, sizeof(struct cvp_kmd_arg));
	karg = kzalloc(sizeof(*karg), GFP_KERNEL);
	if (!karg)
		return -ENOMEM;

	if (convert_from_user(&karg, arg, inst)) {
	if (convert_from_user(karg, arg, inst)) {
		dprintk(CVP_ERR, "%s: failed to get from user cmd %x\n",
			__func__, karg.type);
			__func__, karg->type);
		kfree(karg);
		return -EFAULT;
	}

	rc = msm_cvp_private((void *)inst, cmd, &karg);
	rc = msm_cvp_private((void *)inst, cmd, karg);
	if (rc) {
		dprintk(CVP_ERR, "%s: failed cmd type %x %d\n",
			__func__, karg.type, rc);
			__func__, karg->type, rc);
		kfree(karg);
		return rc;
	}

	if (convert_to_user(&karg, arg)) {
	if (convert_to_user(karg, arg)) {
		dprintk(CVP_ERR, "%s: failed to copy to user cmd %x\n",
			__func__, karg.type);
			__func__, karg->type);
		kfree(karg);
		return -EFAULT;
	}

	kfree(karg);
	return rc;
}