Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/fdt Fix infinite loop like in fdtbus_get_string_index.



details:   https://anonhg.NetBSD.org/src/rev/125596121206
branches:  trunk
changeset: 838378:125596121206
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Mon Jan 14 12:23:53 2019 +0000

description:
Fix infinite loop like in fdtbus_get_string_index.

diffstat:

 sys/dev/fdt/fdt_pinctrl.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 79466aa8d8dd -r 125596121206 sys/dev/fdt/fdt_pinctrl.c
--- a/sys/dev/fdt/fdt_pinctrl.c Mon Jan 14 03:30:25 2019 +0000
+++ b/sys/dev/fdt/fdt_pinctrl.c Mon Jan 14 12:23:53 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_pinctrl.c,v 1.5 2018/06/30 20:34:43 jmcneill Exp $ */
+/* $NetBSD: fdt_pinctrl.c,v 1.6 2019/01/14 12:23:53 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdt_pinctrl.c,v 1.5 2018/06/30 20:34:43 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_pinctrl.c,v 1.6 2019/01/14 12:23:53 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -125,7 +125,7 @@
        pinctrl_names = fdtbus_get_string(phandle, "pinctrl-names");
 
        for (name = pinctrl_names, index = 0; len > 0;
-            name += strlen(name) + 1, index++) {
+            len -= strlen(name) + 1, name += strlen(name) + 1, index++) {
                if (strcmp(name, cfgname) == 0)
                        return fdtbus_pinctrl_set_config_index(phandle, index);
        }



Home | Main Index | Thread Index | Old Index