Module Name:    src
Committed By:   riastradh
Date:           Fri Feb  5 23:49:26 UTC 2016

Modified Files:
        src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/therm:
            nouveau_subdev_therm_temp.c

Log Message:
More useful array bounds check for enum values.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
    
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/therm/nouveau_subdev_therm_temp.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/external/bsd/drm2/dist/drm/nouveau/core/subdev/therm/nouveau_subdev_therm_temp.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/therm/nouveau_subdev_therm_temp.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/therm/nouveau_subdev_therm_temp.c:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/therm/nouveau_subdev_therm_temp.c:1.1.1.1	Wed Aug  6 12:36:32 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/therm/nouveau_subdev_therm_temp.c	Fri Feb  5 23:49:26 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_subdev_therm_temp.c,v 1.1.1.1 2014/08/06 12:36:32 riastradh Exp $	*/
+/*	$NetBSD: nouveau_subdev_therm_temp.c,v 1.2 2016/02/05 23:49:26 riastradh Exp $	*/
 
 /*
  * Copyright 2012 The Nouveau community
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_therm_temp.c,v 1.1.1.1 2014/08/06 12:36:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_therm_temp.c,v 1.2 2016/02/05 23:49:26 riastradh Exp $");
 
 #include "priv.h"
 
@@ -104,7 +104,7 @@ void nouveau_therm_sensor_event(struct n
 	};
 	int temperature = therm->temp_get(therm);
 
-	if (thrs < 0 || thrs > 3)
+	if ((unsigned)thrs >= __arraycount(thresolds))
 		return;
 
 	if (dir == NOUVEAU_THERM_THRS_FALLING)

Reply via email to