2022-07-23 10:50:58

by williamsukatube

[permalink] [raw]
Subject: [PATCH v2] irqchip: mips-gic: check the return value of ioremap() in gic_of_init()

From: William Dean <[email protected]>

The function ioremap() in gic_of_init() can fail, so
its return value should be checked.

Reported-by: Hacash Robot <[email protected]>
Signed-off-by: William Dean <[email protected]>
---
v2: delete fixes tag and correct SoB tag

drivers/irqchip/irq-mips-gic.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c
index ff89b36267dd..a1f6d955794a 100644
--- a/drivers/irqchip/irq-mips-gic.c
+++ b/drivers/irqchip/irq-mips-gic.c
@@ -734,6 +734,10 @@ static int __init gic_of_init(struct device_node *node,
}

mips_gic_base = ioremap(gic_base, gic_len);
+ if (!mips_gic_base) {
+ pr_err("Failed to ioremap gic_base\n");
+ return -ENOMEM;
+ }

gicconfig = read_gic_config();
gic_shared_intrs = FIELD_GET(GIC_CONFIG_NUMINTERRUPTS, gicconfig);
--
2.25.1


Subject: [irqchip: irq/irqchip-next] irqchip/mips-gic: Check the return value of ioremap() in gic_of_init()

The following commit has been merged into the irq/irqchip-next branch of irqchip:

Commit-ID: 71349cc85e5930dce78ed87084dee098eba24b59
Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/71349cc85e5930dce78ed87084dee098eba24b59
Author: William Dean <[email protected]>
AuthorDate: Sat, 23 Jul 2022 18:01:28 +08:00
Committer: Marc Zyngier <[email protected]>
CommitterDate: Sun, 24 Jul 2022 10:54:44 +01:00

irqchip/mips-gic: Check the return value of ioremap() in gic_of_init()

The function ioremap() in gic_of_init() can fail, so
its return value should be checked.

Reported-by: Hacash Robot <[email protected]>
Signed-off-by: William Dean <[email protected]>
Signed-off-by: Marc Zyngier <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
---
drivers/irqchip/irq-mips-gic.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c
index ff89b36..a1f6d95 100644
--- a/drivers/irqchip/irq-mips-gic.c
+++ b/drivers/irqchip/irq-mips-gic.c
@@ -734,6 +734,10 @@ static int __init gic_of_init(struct device_node *node,
}

mips_gic_base = ioremap(gic_base, gic_len);
+ if (!mips_gic_base) {
+ pr_err("Failed to ioremap gic_base\n");
+ return -ENOMEM;
+ }

gicconfig = read_gic_config();
gic_shared_intrs = FIELD_GET(GIC_CONFIG_NUMINTERRUPTS, gicconfig);