Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Add assert that ce->ce_func is not NULL.



details:   https://anonhg.NetBSD.org/src/rev/c3bc9c816897
branches:  trunk
changeset: 749278:c3bc9c816897
user:      rmind <rmind%NetBSD.org@localhost>
date:      Tue Nov 24 20:11:50 2009 +0000

description:
Add assert that ce->ce_func is not NULL.

diffstat:

 sys/kern/subr_callback.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r f6dcfff367d3 -r c3bc9c816897 sys/kern/subr_callback.c
--- a/sys/kern/subr_callback.c  Tue Nov 24 18:19:52 2009 +0000
+++ b/sys/kern/subr_callback.c  Tue Nov 24 20:11:50 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_callback.c,v 1.6 2007/12/05 07:06:54 ad Exp $     */
+/*     $NetBSD: subr_callback.c,v 1.7 2009/11/24 20:11:50 rmind Exp $  */
 
 /*-
  * Copyright (c)2006 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_callback.c,v 1.6 2007/12/05 07:06:54 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_callback.c,v 1.7 2009/11/24 20:11:50 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -63,6 +63,7 @@
     void *obj, int (*fn)(struct callback_entry *, void *, void *))
 {
 
+       KASSERT(fn != NULL);
        ce->ce_func = fn;
        ce->ce_obj = obj;
        mutex_enter(&ch->ch_lock);
@@ -100,6 +101,7 @@
                ce = TAILQ_FIRST(&ch->ch_q);
        }
        KASSERT(ce != NULL);
+       KASSERT(ce->ce_func != NULL);
        result = (*ce->ce_func)(ce, ce->ce_obj, arg);
        ch->ch_next = TAILQ_NEXT(ce, ce_q);
        return result;



Home | Main Index | Thread Index | Old Index