summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2016-12-23 10:29:15 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2016-12-23 10:29:15 +0000
commit7a73670390cd117b8634ea565595740cca2d398b (patch)
tree40107ea81e76287bf971b2e6024be02305d474c6 /sys
parent02b43822f53caf05449077740db2501ea1dd89c2 (diff)
The code to retrieve the interrupt ID only works if the amount of IRQs
supported by the controller is not too big. Otherwise the mask will be wrong and the calculated IRQ as well. Split the dynamic mask into two pieces. First of all use a static mask to remove the bits we don't want to look at. Then we use that value to check for spurious or false IRQs. ok jsg@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/arm/cortex/ampintc.c10
-rw-r--r--sys/arch/arm64/dev/ampintc.c10
2 files changed, 14 insertions, 6 deletions
diff --git a/sys/arch/arm/cortex/ampintc.c b/sys/arch/arm/cortex/ampintc.c
index 693eb0d6d91..de2e1ae789f 100644
--- a/sys/arch/arm/cortex/ampintc.c
+++ b/sys/arch/arm/cortex/ampintc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ampintc.c,v 1.14 2016/08/21 06:47:47 jsg Exp $ */
+/* $OpenBSD: ampintc.c,v 1.15 2016/12/23 10:29:14 patrick Exp $ */
/*
* Copyright (c) 2007,2009,2011 Dale Rahn <drahn@openbsd.org>
*
@@ -488,11 +488,15 @@ ampintc_irq_handler(void *frame)
}
#endif
- if (iack_val == 1023) {
+ irq = iack_val & ICPIAR_IRQ_M;
+
+ if (irq == 1023) {
sc->sc_spur.ec_count++;
return;
}
- irq = iack_val & ((1 << sc->sc_nintr) - 1);
+
+ if (irq >= sc->sc_nintr)
+ return;
pri = sc->sc_ampintc_handler[irq].iq_irq;
s = ampintc_splraise(pri);
diff --git a/sys/arch/arm64/dev/ampintc.c b/sys/arch/arm64/dev/ampintc.c
index c30a71f801c..c17c40a44c0 100644
--- a/sys/arch/arm64/dev/ampintc.c
+++ b/sys/arch/arm64/dev/ampintc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ampintc.c,v 1.1 2016/12/17 23:38:33 patrick Exp $ */
+/* $OpenBSD: ampintc.c,v 1.2 2016/12/23 10:29:14 patrick Exp $ */
/*
* Copyright (c) 2007,2009,2011 Dale Rahn <drahn@openbsd.org>
*
@@ -485,11 +485,15 @@ ampintc_irq_handler(void *frame)
}
#endif
- if (iack_val == 1023) {
+ irq = iack_val & ICPIAR_IRQ_M;
+
+ if (irq == 1023) {
sc->sc_spur.ec_count++;
return;
}
- irq = iack_val & ((1 << sc->sc_nintr) - 1);
+
+ if (irq >= sc->sc_nintr)
+ return;
pri = sc->sc_ampintc_handler[irq].iq_irq;
s = ampintc_splraise(pri);