Module Name:    src
Committed By:   christos
Date:           Mon Apr  3 17:40:07 UTC 2017

Modified Files:
        src/sys/dev/ic: igsfb_subr.c

Log Message:
PR/52136: David Binderman: Rewrite loop to fix bounds check.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/igsfb_subr.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/ic/igsfb_subr.c
diff -u src/sys/dev/ic/igsfb_subr.c:1.13 src/sys/dev/ic/igsfb_subr.c:1.14
--- src/sys/dev/ic/igsfb_subr.c:1.13	Wed Jan 25 12:31:55 2017
+++ src/sys/dev/ic/igsfb_subr.c	Mon Apr  3 13:40:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: igsfb_subr.c,v 1.13 2017/01/25 17:31:55 jakllsch Exp $ */
+/*	$NetBSD: igsfb_subr.c,v 1.14 2017/04/03 17:40:07 christos Exp $ */
 
 /*
  * Copyright (c) 2002 Valeriy E. Ushakov
@@ -32,7 +32,7 @@
  * Integraphics Systems IGA 168x and CyberPro series.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: igsfb_subr.c,v 1.13 2017/01/25 17:31:55 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: igsfb_subr.c,v 1.14 2017/04/03 17:40:07 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -436,10 +436,9 @@ igsfb_hw_setup(struct igsfb_devconfig *d
 	igsfb_init_ext(dc);
 	igsfb_init_dac(dc);
 
-	i = 0;
-	while ((strcmp(dc->dc_modestring, videomode_list[i].name) != 0) &&	
-	       ( i < videomode_count)) {
-		i++;
+	for (i = 0; i < videomode_count; i++) {
+		if (strcmp(dc->dc_modestring, videomode_list[i].name) == 0)
+			break;
 	}
 
 	if (i < videomode_count) {

Reply via email to