[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1599550288-41724-1-git-send-email-liuqi115@huawei.com>
Date: Tue, 8 Sep 2020 15:31:28 +0800
From: Qi Liu <liuqi115@...wei.com>
To: <mathieu.poirier@...aro.org>, <suzuki.poulose@....com>,
<Al.Grant@....com>
CC: <linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <linuxarm@...wei.com>
Subject: [PATCH] coresight: Don't allocate pdata->conns when there is no output port
When there is no output port, coresight_alloc_conns() still do the following
copy connection information to pdata->conns, and this may cause kernel panic.
Let's fix it.
Signed-off-by: Qi Liu <liuqi115@...wei.com>
---
drivers/hwtracing/coresight/coresight-platform.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c
index bfd4423..cdc8824 100644
--- a/drivers/hwtracing/coresight/coresight-platform.c
+++ b/drivers/hwtracing/coresight/coresight-platform.c
@@ -26,12 +26,13 @@
static int coresight_alloc_conns(struct device *dev,
struct coresight_platform_data *pdata)
{
- if (pdata->nr_outport) {
- pdata->conns = devm_kcalloc(dev, pdata->nr_outport,
- sizeof(*pdata->conns), GFP_KERNEL);
- if (!pdata->conns)
- return -ENOMEM;
- }
+ if (!pdata->nr_outport)
+ return -ENOMEM;
+
+ pdata->conns = devm_kcalloc(dev, pdata->nr_outport,
+ sizeof(*pdata->conns), GFP_KERNEL);
+ if (!pdata->conns)
+ return -ENOMEM;
return 0;
}
--
2.8.1
Powered by blists - more mailing lists