Skip to content

Commit d49802b

Browse files
Chen Niwilldeacon
authored andcommitted
perf/arm-cmn: Fix incorrect error check for devm_ioremap()
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: 5394396 ("perf/arm-cmn: Stop claiming entire iomem region") Signed-off-by: Chen Ni <nichen@iscas.ac.cn> Signed-off-by: Will Deacon <will@kernel.org>
1 parent 2f89b7f commit d49802b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/perf/arm-cmn.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2573,8 +2573,8 @@ static int arm_cmn_probe(struct platform_device *pdev)
25732573

25742574
/* Map the whole region now, claim the DTCs once we've found them */
25752575
cmn->base = devm_ioremap(cmn->dev, cfg->start, resource_size(cfg));
2576-
if (IS_ERR(cmn->base))
2577-
return PTR_ERR(cmn->base);
2576+
if (!cmn->base)
2577+
return -ENOMEM;
25782578

25792579
rootnode = arm_cmn_get_root(cmn, cfg);
25802580
if (rootnode < 0)

0 commit comments

Comments
 (0)