Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet6 Use KASSERT for argument NULL checks



details:   https://anonhg.NetBSD.org/src/rev/9181f0101d08
branches:  trunk
changeset: 339158:9181f0101d08
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Tue Jun 30 08:31:42 2015 +0000

description:
Use KASSERT for argument NULL checks

diffstat:

 sys/netinet6/nd6.c |  24 ++++++++++--------------
 1 files changed, 10 insertions(+), 14 deletions(-)

diffs (59 lines):

diff -r 41043eccfcc2 -r 9181f0101d08 sys/netinet6/nd6.c
--- a/sys/netinet6/nd6.c        Tue Jun 30 06:42:06 2015 +0000
+++ b/sys/netinet6/nd6.c        Tue Jun 30 08:31:42 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nd6.c,v 1.162 2015/04/30 10:00:04 ozaki-r Exp $        */
+/*     $NetBSD: nd6.c,v 1.163 2015/06/30 08:31:42 ozaki-r Exp $        */
 /*     $KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $   */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.162 2015/04/30 10:00:04 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.163 2015/06/30 08:31:42 ozaki-r Exp $");
 
 #include "opt_net_mpsafe.h"
 
@@ -279,10 +279,9 @@
        struct nd_opt_hdr *nd_opt;
        int olen;
 
-       if (ndopts == NULL)
-               panic("ndopts == NULL in nd6_option");
-       if (ndopts->nd_opts_last == NULL)
-               panic("uninitialized ndopts in nd6_option");
+       KASSERT(ndopts != NULL);
+       KASSERT(ndopts->nd_opts_last != NULL);
+
        if (ndopts->nd_opts_search == NULL)
                return NULL;
        if (ndopts->nd_opts_done)
@@ -330,10 +329,9 @@
        struct nd_opt_hdr *nd_opt;
        int i = 0;
 
-       if (ndopts == NULL)
-               panic("ndopts == NULL in nd6_options");
-       if (ndopts->nd_opts_last == NULL)
-               panic("uninitialized ndopts in nd6_options");
+       KASSERT(ndopts != NULL);
+       KASSERT(ndopts->nd_opts_last != NULL);
+
        if (ndopts->nd_opts_search == NULL)
                return 0;
  
@@ -1898,10 +1896,8 @@
        int llchange;
        int newstate = 0;
 
-       if (ifp == NULL)
-               panic("ifp == NULL in nd6_cache_lladdr");
-       if (from == NULL)
-               panic("from == NULL in nd6_cache_lladdr");
+       KASSERT(ifp != NULL);
+       KASSERT(from != NULL);
 
        /* nothing must be updated for unspecified address */
        if (IN6_IS_ADDR_UNSPECIFIED(from))



Home | Main Index | Thread Index | Old Index