NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-arm/45359: wrong type casting in the interrupt handler in arch/arm/imx/imxclock.c



>Number:         45359
>Category:       port-arm
>Synopsis:       wrong type casting in the interrupt handler in 
>arch/arm/imx/imxclock.c
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-arm-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 12 14:30:00 +0000 2011
>Originator:     Yuichiro Goto
>Release:        5.99.55
>Organization:
>Environment:
>Description:
Casting argument "arg" of the interrupt handler imxclock_intr() to
"struct clockframe *" is not correct.

Because the interrupt handler has been established using
intr_establish() with non-null argument for the handler,
that argument is passed to the handler instead of the clock
frame when an interrupt is occurred.
>How-To-Repeat:

>Fix:
See the below diff:

Index: arch/arm/imx/imxclock.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/imx/imxclock.c,v
retrieving revision 1.4
diff -u -r1.4 imxclock.c
--- arch/arm/imx/imxclock.c     1 Jul 2011 20:27:50 -0000       1.4
+++ arch/arm/imx/imxclock.c     12 Sep 2011 13:54:56 -0000
@@ -99,7 +99,7 @@
        bus_space_write_4(epit1_sc->sc_iot, epit1_sc->sc_ioh, EPIT_EPITCR, reg);
 
        epit1_sc->sc_ih = intr_establish(epit1_sc->sc_intr, IPL_CLOCK,
-           IST_LEVEL, imxclock_intr, epit1_sc);
+           IST_LEVEL, imxclock_intr, NULL);
 }
 
 #if 0
@@ -117,7 +117,7 @@
 static int
 imxclock_intr(void *arg)
 {
-       struct imxclock_softc *sc = arg;
+       struct imxclock_softc *sc = epit1_sc;
 
        bus_space_write_4(sc->sc_iot, sc->sc_ioh, EPIT_EPITSR, 1);
        atomic_add_32(&imxclock_base, sc->sc_reload_value);



Home | Main Index | Thread Index | Old Index