diff options
| author | Satyajit Desai <sadesai@codeaurora.org> | 2016-10-21 17:24:48 -0700 |
|---|---|---|
| committer | Satyajit Desai <sadesai@codeaurora.org> | 2016-10-24 10:57:41 -0700 |
| commit | 2b5e9d5cb61478253ad47e999bba205dbce74e92 (patch) | |
| tree | 884fb0654716f26dc3977460b764f751d1201a7a | |
| parent | 46aa49c1188a77f52dc4969f82292c176d8f399b (diff) | |
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: Satyajit Desai <sadesai@codeaurora.org>
| -rw-r--r-- | drivers/hwtracing/coresight/coresight-tmc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c index 306465ededf9..766b052ade1d 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c @@ -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; |
