[PATCH 1/1] lib: sbi_irqchip: error handling in sbi_irqchip_raw_handler_default()

Heinrich Schuchardt <[email protected]>
Newsgroups org.infradead.lists.opensbi
Message-ID <[email protected]>
sbi_irqchip_find_handler() may return NULL.
Check the return value before dereferencing.

Addresses-Coverity-ID: 1677408 Dereference null return value
Signed-off-by: Heinrich Schuchardt <[email protected]>
---
 lib/sbi/sbi_irqchip.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/sbi/sbi_irqchip.c b/lib/sbi/sbi_irqchip.c
index b490a3ad..1664bd2d 100644
--- a/lib/sbi/sbi_irqchip.c
+++ b/lib/sbi/sbi_irqchip.c
@@ -185,6 +185,9 @@ int sbi_irqchip_raw_handler_default(struct sbi_irqchip_device *chip, u32 hwirq)
 		return SBI_EINVAL;
 
 	h = sbi_irqchip_find_handler(chip, hwirq);
+	if (!h)
+		return SBI_EINVAL;
+
 	if (h->callback)
 		rc = h->callback(hwirq, h->priv);
 
-- 
2.53.0


-- 
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.