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 get_specifier_by_index to work with indexes ...



details:   https://anonhg.NetBSD.org/src/rev/5fcb440bc5be
branches:  trunk
changeset: 345410:5fcb440bc5be
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Wed May 25 12:43:08 2016 +0000

description:
Fix get_specifier_by_index to work with indexes greater than 0.

diffstat:

 sys/dev/fdt/fdt_intr.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (35 lines):

diff -r 5b5940d7c99a -r 5fcb440bc5be sys/dev/fdt/fdt_intr.c
--- a/sys/dev/fdt/fdt_intr.c    Wed May 25 10:15:01 2016 +0000
+++ b/sys/dev/fdt/fdt_intr.c    Wed May 25 12:43:08 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_intr.c,v 1.7 2016/01/10 23:01:29 marty Exp $ */
+/* $NetBSD: fdt_intr.c,v 1.8 2016/05/25 12:43:08 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.7 2016/01/10 23:01:29 marty Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.8 2016/05/25 12:43:08 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -334,7 +334,6 @@
                return NULL;
        }
 
-       const u_int clen = interrupt_cells * sizeof(u_int);
        const u_int nintr = len / interrupt_cells;
 
        if (pindex >= nintr)
@@ -349,7 +348,7 @@
        specifier = kmem_alloc(interrupt_cells * sizeof(u_int), KM_SLEEP);
        *spec_length = interrupt_cells * sizeof(u_int);
        for (int i = 0; i < interrupt_cells; i++)
-               specifier[i] = specifiers[pindex * clen + i];
+               specifier[i] = specifiers[pindex * interrupt_cells + i];
        kmem_free(specifiers, len);
        return specifier;
 }



Home | Main Index | Thread Index | Old Index