Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev more sanity checks
details: https://anonhg.NetBSD.org/src/rev/d8f3e1d97061
branches: trunk
changeset: 812561:d8f3e1d97061
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Mon Dec 21 12:30:29 2015 +0000
description:
more sanity checks
diffstat:
sys/dev/dksubr.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diffs (39 lines):
diff -r a0f9ea85a52b -r d8f3e1d97061 sys/dev/dksubr.c
--- a/sys/dev/dksubr.c Mon Dec 21 12:11:23 2015 +0000
+++ b/sys/dev/dksubr.c Mon Dec 21 12:30:29 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.83 2015/12/08 20:36:14 christos Exp $ */
+/* $NetBSD: dksubr.c,v 1.84 2015/12/21 12:30:29 mlelstv Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.83 2015/12/08 20:36:14 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.84 2015/12/21 12:30:29 mlelstv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -94,6 +94,8 @@
void
dk_attach(struct dk_softc *dksc)
{
+ KASSERT(dksc->sc_dev != NULL);
+
mutex_init(&dksc->sc_iolock, MUTEX_DEFAULT, IPL_VM);
dksc->sc_flags |= DKF_READYFORDUMP;
#ifdef DIAGNOSTIC
@@ -307,6 +309,11 @@
const struct dkdriver *dkd = dksc->sc_dkdev.dk_driver;
int error;
+ if (!(dksc->sc_flags & DKF_INITED)) {
+ DPRINTF_FOLLOW(("%s: not inited\n", __func__));
+ return;
+ }
+
mutex_enter(&dksc->sc_iolock);
if (bp != NULL)
Home |
Main Index |
Thread Index |
Old Index