From: Chen Ni <nichen@iscas.ac.cn>
To: will@kernel.org
Cc: robin.murphy@arm.com, mark.rutland@arm.com,
ilkka@os.amperecomputing.com,
linux-arm-kernel@lists.infradead.org,
linux-perf-users@vger.kernel.org, Chen Ni <nichen@iscas.ac.cn>
Subject: [PATCH] perf/arm-cmn: Fix incorrect error check for devm_ioremap()
Date: Thu, 26 Mar 2026 17:08:56 +0800 [thread overview]
Message-ID: <20260326090856.644136-1-nichen@iscas.ac.cn> (raw)
Check devm_ioremap() return value for NULL instead of ERR_PTR and return
-ENOMEM on failure. devm_ioremap() never returns ERR_PTR, using IS_ERR()
skips the error path and may cause a NULL pointer dereference.
Fixes: 5394396ff548 ("perf/arm-cmn: Stop claiming entire iomem region")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
drivers/perf/arm-cmn.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
index 1ac91cda6780..9fe00d0f4deb 100644
--- a/drivers/perf/arm-cmn.c
+++ b/drivers/perf/arm-cmn.c
@@ -2573,8 +2573,8 @@ static int arm_cmn_probe(struct platform_device *pdev)
/* Map the whole region now, claim the DTCs once we've found them */
cmn->base = devm_ioremap(cmn->dev, cfg->start, resource_size(cfg));
- if (IS_ERR(cmn->base))
- return PTR_ERR(cmn->base);
+ if (!cmn->base)
+ return -ENOMEM;
rootnode = arm_cmn_get_root(cmn, cfg);
if (rootnode < 0)
--
2.25.1
next reply other threads:[~2026-03-26 9:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-26 9:08 Chen Ni [this message]
2026-03-26 15:34 ` [PATCH] perf/arm-cmn: Fix incorrect error check for devm_ioremap() Will Deacon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260326090856.644136-1-nichen@iscas.ac.cn \
--to=nichen@iscas.ac.cn \
--cc=ilkka@os.amperecomputing.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox