Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic PR/52136: David Binderman: Rewrite loop to fix bo...



details:   https://anonhg.NetBSD.org/src/rev/9429d6eaaea9
branches:  trunk
changeset: 822735:9429d6eaaea9
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Apr 03 17:40:07 2017 +0000

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

diffstat:

 sys/dev/ic/igsfb_subr.c |  11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diffs (32 lines):

diff -r 78ab72d34ba3 -r 9429d6eaaea9 sys/dev/ic/igsfb_subr.c
--- a/sys/dev/ic/igsfb_subr.c   Mon Apr 03 17:37:29 2017 +0000
+++ b/sys/dev/ic/igsfb_subr.c   Mon Apr 03 17:40:07 2017 +0000
@@ -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_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) {



Home | Main Index | Thread Index | Old Index