Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb fix off by one



details:   https://anonhg.NetBSD.org/src/rev/bde1c65459db
branches:  trunk
changeset: 350450:bde1c65459db
user:      maya <maya%NetBSD.org@localhost>
date:      Wed Jan 11 22:09:38 2017 +0000

description:
fix off by one

diffstat:

 sys/dev/usb/uhso.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (46 lines):

diff -r 1a00e243bc49 -r bde1c65459db sys/dev/usb/uhso.c
--- a/sys/dev/usb/uhso.c        Wed Jan 11 21:44:50 2017 +0000
+++ b/sys/dev/usb/uhso.c        Wed Jan 11 22:09:38 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhso.c,v 1.24 2016/11/25 12:56:29 skrll Exp $  */
+/*     $NetBSD: uhso.c,v 1.25 2017/01/11 22:09:38 maya Exp $   */
 
 /*-
  * Copyright (c) 2009 Iain Hibbert
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhso.c,v 1.24 2016/11/25 12:56:29 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhso.c,v 1.25 2017/01/11 22:09:38 maya Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -641,14 +641,14 @@
 
        switch (hd->type) {
        case UHSOTYPE_DEFAULT:
-               if (ifnum > __arraycount(uhso_spec_default))
+               if (ifnum >= __arraycount(uhso_spec_default))
                        break;
 
                *spec = uhso_spec_default[ifnum];
                return 1;
 
        case UHSOTYPE_ICON321:
-               if (ifnum > __arraycount(uhso_spec_icon321))
+               if (ifnum >= __arraycount(uhso_spec_icon321))
                        break;
 
                *spec = uhso_spec_icon321[ifnum];
@@ -665,8 +665,8 @@
                if (status != USBD_NORMAL_COMPLETION)
                        break;
 
-               if (ifnum > __arraycount(config)
-                   || config[ifnum] > __arraycount(uhso_spec_config))
+               if (ifnum >= __arraycount(config)
+                   || config[ifnum] >= __arraycount(uhso_spec_config))
                        break;
 
                *spec = uhso_spec_config[config[ifnum]];



Home | Main Index | Thread Index | Old Index