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

Commit 2b5e9d5c authored by Satyajit Desai's avatar Satyajit Desai
Browse files

coresight: tmc: skip tmc read if mem allocaiton failed



Add NULL pointer check to ensure that we do copy to user only
when we were able to allocate memory for ETR.

Change-Id: I09b4bc37617811fd4acd86a7e4f5ef91630675df
Signed-off-by: default avatarSatyajit Desai <sadesai@codeaurora.org>
parent 46aa49c1
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1143,6 +1143,12 @@ static int tmc_read_prepare(struct tmc_drvdata *drvdata)
		goto err;
	}

	if (drvdata->config_type == TMC_CONFIG_TYPE_ETR &&
	    drvdata->vaddr == NULL) {
		ret = -ENOMEM;
		goto err;
	}

	if (!drvdata->enable)
		goto out;