Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi Avoid reading one byte past end of array.



details:   https://anonhg.NetBSD.org/src/rev/9c14ce846c59
branches:  trunk
changeset: 813785:9c14ce846c59
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Feb 18 15:42:44 2016 +0000

description:
Avoid reading one byte past end of array.

Fixes

   acpiout0: brightness levels: [20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,uvm_fault(0xffffffff8133d200, 0xffff80000c1d8000, 1) -> e
   fatal page fault in supervisor mode
   trap type 6 code 0 rip ffffffff803b63d7 cs 8 rflags 10212 cr2 ffff80000c1d8000 ilevel 8 rsp ffffffff816a1b00

diffstat:

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

diffs (27 lines):

diff -r 2beba3e54a5e -r 9c14ce846c59 sys/dev/acpi/acpi_display.c
--- a/sys/dev/acpi/acpi_display.c       Thu Feb 18 06:18:58 2016 +0000
+++ b/sys/dev/acpi/acpi_display.c       Thu Feb 18 15:42:44 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi_display.c,v 1.13 2016/01/06 01:37:17 christos Exp $       */
+/*     $NetBSD: acpi_display.c,v 1.14 2016/02/18 15:42:44 riastradh Exp $      */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_display.c,v 1.13 2016/01/06 01:37:17 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_display.c,v 1.14 2016/02/18 15:42:44 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -1885,7 +1885,7 @@
                (*pr)("[");
 
        for (size_t i = 0; i < l; i++) {
-               for (b = e = a[i]; i < l && a[i + 1] == e + 1; i++, e++)
+               for (b = e = a[i]; i + 1 < l && a[i + 1] == e + 1; i++, e++)
                        continue;
                (*pr)("%"PRIu8, b);
                if (b != e)



Home | Main Index | Thread Index | Old Index