Module Name: src
Committed By: pgoyette
Date: Fri Jul 22 12:03:15 UTC 2016
Modified Files:
src/sys/kern [pgoyette-localcount]: subr_autoconf.c
Log Message:
Fix logic to avoid dereferencing NULL pointer
To generate a diff of this commit:
cvs rdiff -u -r1.246.2.4 -r1.246.2.5 src/sys/kern/subr_autoconf.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/subr_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.246.2.4 src/sys/kern/subr_autoconf.c:1.246.2.5
--- src/sys/kern/subr_autoconf.c:1.246.2.4 Fri Jul 22 02:05:39 2016
+++ src/sys/kern/subr_autoconf.c Fri Jul 22 12:03:15 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.246.2.4 2016/07/22 02:05:39 pgoyette Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.246.2.5 2016/07/22 12:03:15 pgoyette Exp $ */
/*
* Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.246.2.4 2016/07/22 02:05:39 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.246.2.5 2016/07/22 12:03:15 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@@ -2273,7 +2273,7 @@ device_lookup_acquire(cfdriver_t cd, int
dv = NULL;
else if ((dv = cd->cd_devs[unit]) != NULL && dv->dv_del_gen != 0)
dv = NULL;
- else
+ if (dv != NULL)
localcount_acquire(dv->dv_localcnt);
mutex_exit(&alldevs_mtx);