NetBSD Problem Report #45359

From www@NetBSD.org  Mon Sep 12 14:27:29 2011
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id DCA0F63C40C
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 12 Sep 2011 14:27:28 +0000 (UTC)
Message-Id: <20110912142728.417D163BBA9@www.NetBSD.org>
Date: Mon, 12 Sep 2011 14:27:28 +0000 (UTC)
From: y7goto@gmail.com
Reply-To: y7goto@gmail.com
To: gnats-bugs@NetBSD.org
Subject: wrong type casting in the interrupt handler in arch/arm/imx/imxclock.c
X-Send-Pr-Version: www-1.0

>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:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 12 14:30:00 +0000 2011
>Closed-Date:    Fri Oct 05 05:30:27 +0000 2012
>Last-Modified:  Fri Oct 05 05:30:27 +0000 2012
>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);

>Release-Note:

>Audit-Trail:
From: "Matt Thomas" <matt@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/45359 CVS commit: src/sys/arch/arm/imx
Date: Sun, 20 May 2012 14:08:18 +0000

 Module Name:	src
 Committed By:	matt
 Date:		Sun May 20 14:08:18 UTC 2012

 Modified Files:
 	src/sys/arch/arm/imx: imxclock.c

 Log Message:
 Fix call of imxclock.  Patch from PR/45359.


 To generate a diff of this commit:
 cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/imxclock.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: mrg@NetBSD.org
State-Changed-When: Fri, 05 Oct 2012 05:30:27 +0000
State-Changed-Why:
patch applied by matt@ several months ago.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.