All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] irqchip/loongson-eiointc: Check hwirq overflow
@ 2022-08-03  4:27 Huacai Chen
  2022-08-03  4:27 ` [PATCH 2/2] irqchip/loongson-eiointc: Fix irq affinity setting Huacai Chen
  2022-08-03  7:20 ` [PATCH 1/2] irqchip/loongson-eiointc: Check hwirq overflow Marc Zyngier
  0 siblings, 2 replies; 6+ messages in thread
From: Huacai Chen @ 2022-08-03  4:27 UTC (permalink / raw)
  To: Thomas Gleixner, Marc Zyngier
  Cc: loongarch, linux-kernel, Xuefeng Li, Huacai Chen, Jiaxun Yang,
	Huacai Chen

Check hwirq overflow when allocate irq in eiointc domain.

Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
 drivers/irqchip/irq-loongson-eiointc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-loongson-eiointc.c b/drivers/irqchip/irq-loongson-eiointc.c
index 80d8ca6f2d46..f8060e58ee06 100644
--- a/drivers/irqchip/irq-loongson-eiointc.c
+++ b/drivers/irqchip/irq-loongson-eiointc.c
@@ -241,8 +241,11 @@ static int eiointc_domain_alloc(struct irq_domain *domain, unsigned int virq,
 	struct eiointc *priv = domain->host_data;
 
 	ret = irq_domain_translate_onecell(domain, arg, &hwirq, &type);
-	if (ret)
-		return ret;
+	if (ret < 0)
+		return -EINVAL;
+
+	if (hwirq >= IOCSR_EXTIOI_VECTOR_NUM)
+		return -EINVAL;
 
 	for (i = 0; i < nr_irqs; i++) {
 		irq_domain_set_info(domain, virq + i, hwirq + i, &eiointc_irq_chip,
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-08-04  2:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-03  4:27 [PATCH 1/2] irqchip/loongson-eiointc: Check hwirq overflow Huacai Chen
2022-08-03  4:27 ` [PATCH 2/2] irqchip/loongson-eiointc: Fix irq affinity setting Huacai Chen
2022-08-03  7:20 ` [PATCH 1/2] irqchip/loongson-eiointc: Check hwirq overflow Marc Zyngier
2022-08-03  7:33   ` Huacai Chen
2022-08-03 11:58     ` Jianmin Lv
2022-08-04  2:46       ` Huacai Chen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.