Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sysmon Avoid dereferencing NULL if we attempt to loo...



details:   https://anonhg.NetBSD.org/src/rev/f63472e13163
branches:  trunk
changeset: 319339:f63472e13163
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat May 26 21:15:46 2018 +0000

description:
Avoid dereferencing NULL if we attempt to look up an known unit type.

diffstat:

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

diffs (27 lines):

diff -r 783c39ab88ad -r f63472e13163 sys/dev/sysmon/sysmon_envsys.c
--- a/sys/dev/sysmon/sysmon_envsys.c    Sat May 26 21:07:47 2018 +0000
+++ b/sys/dev/sysmon/sysmon_envsys.c    Sat May 26 21:15:46 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysmon_envsys.c,v 1.142 2018/05/05 00:14:28 pgoyette Exp $     */
+/*     $NetBSD: sysmon_envsys.c,v 1.143 2018/05/26 21:15:46 thorpej Exp $      */
 
 /*-
  * Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.142 2018/05/05 00:14:28 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.143 2018/05/26 21:15:46 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -578,7 +578,7 @@
         * Find the correct units for this sensor.
         */
        sdt_units = sme_find_table_entry(SME_DESC_UNITS, edata->units);
-       if (sdt_units->type == -1)
+       if (sdt_units == NULL || sdt_units->type == -1)
                return EINVAL;
 
        /*



Home | Main Index | Thread Index | Old Index