Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 5394396ff548 ("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>

authored by

Chen Ni and committed by
Will Deacon
d49802b6 2f89b7f7

+2 -2
+2 -2
drivers/perf/arm-cmn.c
··· 2573 2573 2574 2574 /* Map the whole region now, claim the DTCs once we've found them */ 2575 2575 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; 2578 2578 2579 2579 rootnode = arm_cmn_get_root(cmn, cfg); 2580 2580 if (rootnode < 0)