summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authormsaitoh <msaitoh@NetBSD.org>2019-11-12 13:10:51 +0000
committermsaitoh <msaitoh@NetBSD.org>2019-11-12 13:10:51 +0000
commit85c0054443ea9cf850928992ef37ff7204519871 (patch)
tree3ec87d9be3e1a7aeed51a3515f4f9fcdcd9667f6 /sys/dev
parentbfb9269cf605e1d64862ff67afc31ac47ca840fc (diff)
Initialize sc_dev correctly to avoid null pointer dereference when
bus_space_map() failed.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/isa/uha_isa.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/isa/uha_isa.c b/sys/dev/isa/uha_isa.c
index e5bee46f89c..dda63c41a9a 100644
--- a/sys/dev/isa/uha_isa.c
+++ b/sys/dev/isa/uha_isa.c
@@ -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 @@ uha_isa_attach(device_t parent, device_t self, void *aux)
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 @@ uha_isa_attach(device_t parent, device_t self, void *aux)
return;
}
- sc->sc_dev = self;
sc->sc_iot = iot;
sc->sc_ioh = ioh;
sc->sc_dmat = dmat;