Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/mips/ralink gcc thinks the static "led_index" could...



details:   https://anonhg.NetBSD.org/src/rev/360d631d7357
branches:  trunk
changeset: 970055:360d631d7357
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Mar 10 11:07:39 2020 +0000

description:
gcc thinks the static "led_index" could get out of range - not sure
how that should happen, but test for >= instead of == on the
array size.

diffstat:

 sys/arch/mips/ralink/ralink_gpio.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 6ae421eaded6 -r 360d631d7357 sys/arch/mips/ralink/ralink_gpio.c
--- a/sys/arch/mips/ralink/ralink_gpio.c        Tue Mar 10 10:35:14 2020 +0000
+++ b/sys/arch/mips/ralink/ralink_gpio.c        Tue Mar 10 11:07:39 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ralink_gpio.c,v 1.7 2019/06/03 06:04:20 msaitoh Exp $  */
+/*     $NetBSD: ralink_gpio.c,v 1.8 2020/03/10 11:07:39 martin Exp $   */
 /*-
  * Copyright (c) 2011 CradlePoint Technology, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
 /* ra_gpio.c -- Ralink 3052 gpio driver */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ralink_gpio.c,v 1.7 2019/06/03 06:04:20 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ralink_gpio.c,v 1.8 2020/03/10 11:07:39 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -1580,7 +1580,7 @@
            (1 << (led_array1[led_index++] - SS_OFFSET)));
 #endif
 
-       if (led_index == (sizeof(led_array1))) {
+       if (led_index >= (sizeof(led_array1))) {
                led_index = 0;
                for (int i = 0; i < sizeof(led_array1); i++) {
                        ra_gpio_pin_write(sc, led_array1[i], 1);



Home | Main Index | Thread Index | Old Index