Source-Changes-HG archive

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

[src/trunk]: src/sys/kern add KASSERT()s to ensure aprint_*_dev() and aprint_...



details:   https://anonhg.NetBSD.org/src/rev/cab05922b108
branches:  trunk
changeset: 838390:cab05922b108
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Mon Jan 14 19:21:54 2019 +0000

description:
add KASSERT()s to ensure aprint_*_dev() and aprint_*_ifp() is not called
with NULL dv or ifp respectively

related to PR kern/53789

diffstat:

 sys/kern/subr_prf.c |  24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diffs (108 lines):

diff -r 92fc9770d11e -r cab05922b108 sys/kern/subr_prf.c
--- a/sys/kern/subr_prf.c       Mon Jan 14 18:54:07 2019 +0000
+++ b/sys/kern/subr_prf.c       Mon Jan 14 19:21:54 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_prf.c,v 1.175 2019/01/07 13:09:48 martin Exp $    */
+/*     $NetBSD: subr_prf.c,v 1.176 2019/01/14 19:21:54 jdolecek Exp $  */
 
 /*-
  * Copyright (c) 1986, 1988, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.175 2019/01/07 13:09:48 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.176 2019/01/14 19:21:54 jdolecek Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -808,6 +808,8 @@
 {
        va_list ap;
 
+       KASSERT(dv != NULL);
+
        va_start(ap, fmt);
        aprint_normal_internal(device_xname(dv), fmt, ap);
        va_end(ap);
@@ -818,6 +820,8 @@
 {
        va_list ap;
 
+       KASSERT(ifp != NULL);
+
        va_start(ap, fmt);
        aprint_normal_internal(ifp->if_xname, fmt, ap);
        va_end(ap);
@@ -885,6 +889,8 @@
 {
        va_list ap;
 
+       KASSERT(dv != NULL);
+
        va_start(ap, fmt);
        aprint_error_internal(device_xname(dv), fmt, ap);
        va_end(ap);
@@ -895,6 +901,8 @@
 {
        va_list ap;
 
+       KASSERT(ifp != NULL);
+
        va_start(ap, fmt);
        aprint_error_internal(ifp->if_xname, fmt, ap);
        va_end(ap);
@@ -934,6 +942,8 @@
 {
        va_list ap;
 
+       KASSERT(dv != NULL);
+
        va_start(ap, fmt);
        aprint_naive_internal(device_xname(dv), fmt, ap);
        va_end(ap);
@@ -944,6 +954,8 @@
 {
        va_list ap;
 
+       KASSERT(ifp != NULL);
+
        va_start(ap, fmt);
        aprint_naive_internal(ifp->if_xname, fmt, ap);
        va_end(ap);
@@ -988,6 +1000,8 @@
 {
        va_list ap;
 
+       KASSERT(dv != NULL);
+
        va_start(ap, fmt);
        aprint_verbose_internal(device_xname(dv), fmt, ap);
        va_end(ap);
@@ -998,6 +1012,8 @@
 {
        va_list ap;
 
+       KASSERT(ifp != NULL);
+
        va_start(ap, fmt);
        aprint_verbose_internal(ifp->if_xname, fmt, ap);
        va_end(ap);
@@ -1036,6 +1052,8 @@
 {
        va_list ap;
 
+       KASSERT(dv != NULL);
+
        va_start(ap, fmt);
        aprint_debug_internal(device_xname(dv), fmt, ap);
        va_end(ap);
@@ -1046,6 +1064,8 @@
 {
        va_list ap;
 
+       KASSERT(ifp != NULL);
+
        va_start(ap, fmt);
        aprint_debug_internal(ifp->if_xname, fmt, ap);
        va_end(ap);



Home | Main Index | Thread Index | Old Index