Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hppa/dev Reorder to avoid null deref before null test



details:   https://anonhg.NetBSD.org/src/rev/99fa70f1541b
branches:  trunk
changeset: 827044:99fa70f1541b
user:      maya <maya%NetBSD.org@localhost>
date:      Tue Oct 10 13:47:27 2017 +0000

description:
Reorder to avoid null deref before null test

diffstat:

 sys/arch/hppa/dev/mongoose.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r d33b774ad6c6 -r 99fa70f1541b sys/arch/hppa/dev/mongoose.c
--- a/sys/arch/hppa/dev/mongoose.c      Tue Oct 10 11:52:51 2017 +0000
+++ b/sys/arch/hppa/dev/mongoose.c      Tue Oct 10 13:47:27 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mongoose.c,v 1.3 2014/03/31 20:51:20 christos Exp $    */
+/*     $NetBSD: mongoose.c,v 1.4 2017/10/10 13:47:27 maya Exp $        */
 
 /*     $OpenBSD: mongoose.c,v 1.19 2010/01/01 20:28:42 kettenis Exp $  */
 
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mongoose.c,v 1.3 2014/03/31 20:51:20 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mongoose.c,v 1.4 2017/10/10 13:47:27 maya Exp $");
 
 #define MONGOOSE_DEBUG 9
 
@@ -325,12 +325,14 @@
 {
        struct hppa_isa_iv *iv = cookie;
        struct mongoose_softc *sc = v;
-       int irq = iv - sc->sc_iv;
+       int irq;
        volatile uint8_t *imr;
 
        if (!sc || !cookie)
                return;
 
+       irq = iv - sc->sc_iv;
+
        if (irq < 8)
                imr = &sc->sc_ctrl->imr0;
        else



Home | Main Index | Thread Index | Old Index