Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/riscv/riscv PR/53206: David Binderman: fix array bo...



details:   https://anonhg.NetBSD.org/src/rev/b37b0e206605
branches:  trunk
changeset: 361315:b37b0e206605
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Apr 23 15:40:33 2018 +0000

description:
PR/53206: David Binderman: fix array bounds comparison in KASSERT.

diffstat:

 sys/arch/riscv/riscv/db_machdep.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r ad084ee81fb2 -r b37b0e206605 sys/arch/riscv/riscv/db_machdep.c
--- a/sys/arch/riscv/riscv/db_machdep.c Mon Apr 23 15:36:30 2018 +0000
+++ b/sys/arch/riscv/riscv/db_machdep.c Mon Apr 23 15:40:33 2018 +0000
@@ -29,7 +29,7 @@
 
 #include <sys/cdefs.h>
 
-__RCSID("$NetBSD: db_machdep.c,v 1.1 2015/03/28 16:13:56 matt Exp $");
+__RCSID("$NetBSD: db_machdep.c,v 1.2 2018/04/23 15:40:33 christos Exp $");
 
 #include <sys/param.h>
 
@@ -86,7 +86,7 @@
 db_rw_ddbreg(const struct db_variable *vp, db_expr_t *valp, int rw)
 {
        struct trapframe * const tf = curcpu()->ci_ddb_regs;
-       KASSERT(db_regs <= vp && vp < db_regs);
+       KASSERT(db_regs <= vp && vp < db_regs + __arraycount(db_regs));
        const uintptr_t addr = (uintptr_t)tf + (uintptr_t)vp->valuep; 
        if (vp->modif != NULL && vp->modif[0] == 'i') {
                if (rw == DB_VAR_GET) {



Home | Main Index | Thread Index | Old Index