Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/isa Initialize sc_dev correctly to avoid null pointe...



details:   https://anonhg.NetBSD.org/src/rev/e07772ffbc0d
branches:  trunk
changeset: 460985:e07772ffbc0d
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Nov 12 13:10:51 2019 +0000

description:
Initialize sc_dev correctly to avoid null pointer dereference when
bus_space_map() failed.

diffstat:

 sys/dev/isa/uha_isa.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r 250e295af3a2 -r e07772ffbc0d sys/dev/isa/uha_isa.c
--- a/sys/dev/isa/uha_isa.c     Tue Nov 12 12:50:30 2019 +0000
+++ b/sys/dev/isa/uha_isa.c     Tue Nov 12 13:10:51 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uha_isa.c,v 1.41 2014/10/18 08:33:28 snj Exp $ */
+/*     $NetBSD: uha_isa.c,v 1.42 2019/11/12 13:10:51 msaitoh Exp $     */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uha_isa.c,v 1.41 2014/10/18 08:33:28 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uha_isa.c,v 1.42 2019/11/12 13:10:51 msaitoh Exp $");
 
 #include "opt_ddb.h"
 
@@ -143,6 +143,7 @@
        isa_chipset_tag_t ic = ia->ia_ic;
        int error;
 
+       sc->sc_dev = self;
        printf("\n");
 
        if (bus_space_map(iot, ia->ia_io[0].ir_addr, UHA_ISA_IOSIZE, 0, &ioh)) {
@@ -150,7 +151,6 @@
                return;
        }
 
-       sc->sc_dev = self;
        sc->sc_iot = iot;
        sc->sc_ioh = ioh;
        sc->sc_dmat = dmat;



Home | Main Index | Thread Index | Old Index