Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc/sparc Add KASSERTs to catch access to NULL OF...



details:   https://anonhg.NetBSD.org/src/rev/1cfcf5c24639
branches:  trunk
changeset: 822584:1cfcf5c24639
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Mar 26 12:38:24 2017 +0000

description:
Add KASSERTs to catch access to NULL OF nodes early

diffstat:

 sys/arch/sparc/sparc/openfirm.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r 28a4926b7753 -r 1cfcf5c24639 sys/arch/sparc/sparc/openfirm.c
--- a/sys/arch/sparc/sparc/openfirm.c   Sun Mar 26 12:36:43 2017 +0000
+++ b/sys/arch/sparc/sparc/openfirm.c   Sun Mar 26 12:38:24 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: openfirm.c,v 1.22 2016/04/07 19:46:39 palle Exp $      */
+/*     $NetBSD: openfirm.c,v 1.23 2017/03/26 12:38:24 martin Exp $     */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.22 2016/04/07 19:46:39 palle Exp $");
+__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.23 2017/03/26 12:38:24 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -166,6 +166,7 @@
                cell_t size;
        } args;
 
+       KASSERT(handle != 0);
        args.name = ADR2CELL("getproplen");
        args.nargs = 2;
        args.nreturns = 1;
@@ -190,6 +191,7 @@
                cell_t size;
        } args;
 
+       KASSERT(handle != 0);
        if (buflen > NBPG)
                return -1;
        args.name = ADR2CELL("getprop");



Home | Main Index | Thread Index | Old Index