Module Name: src Committed By: thorpej Date: Sat May 26 21:15:46 UTC 2018
Modified Files: src/sys/dev/sysmon: sysmon_envsys.c Log Message: Avoid dereferencing NULL if we attempt to look up an known unit type. To generate a diff of this commit: cvs rdiff -u -r1.142 -r1.143 src/sys/dev/sysmon/sysmon_envsys.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/dev/sysmon/sysmon_envsys.c diff -u src/sys/dev/sysmon/sysmon_envsys.c:1.142 src/sys/dev/sysmon/sysmon_envsys.c:1.143 --- src/sys/dev/sysmon/sysmon_envsys.c:1.142 Sat May 5 00:14:28 2018 +++ src/sys/dev/sysmon/sysmon_envsys.c Sat May 26 21:15:46 2018 @@ -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 @@ sysmon_envsys_sensor_attach(struct sysmo * 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; /*