Module Name:    src
Committed By:   christos
Date:           Mon Apr 23 15:40:33 UTC 2018

Modified Files:
        src/sys/arch/riscv/riscv: db_machdep.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/riscv/riscv/db_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/riscv/riscv/db_machdep.c
diff -u src/sys/arch/riscv/riscv/db_machdep.c:1.1 src/sys/arch/riscv/riscv/db_machdep.c:1.2
--- src/sys/arch/riscv/riscv/db_machdep.c:1.1	Sat Mar 28 12:13:56 2015
+++ src/sys/arch/riscv/riscv/db_machdep.c	Mon Apr 23 11:40:33 2018
@@ -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 @@ int
 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) {

Reply via email to