Source-Changes-HG archive

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

[src/pgoyette-localcount]: src/sys/kern Fix logic to avoid dereferencing NULL...



details:   https://anonhg.NetBSD.org/src/rev/f285d5debe96
branches:  pgoyette-localcount
changeset: 852844:f285d5debe96
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Fri Jul 22 12:03:15 2016 +0000

description:
Fix logic to avoid dereferencing NULL pointer

diffstat:

 sys/kern/subr_autoconf.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 61774d490353 -r f285d5debe96 sys/kern/subr_autoconf.c
--- a/sys/kern/subr_autoconf.c  Fri Jul 22 11:59:51 2016 +0000
+++ b/sys/kern/subr_autoconf.c  Fri Jul 22 12:03:15 2016 +0000
@@ -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 @@
                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);
 



Home | Main Index | Thread Index | Old Index