Source-Changes-HG archive

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

[src/trunk]: src/sys Use KASSERT for checking non-NULL of ifa->ifa_ifp



details:   https://anonhg.NetBSD.org/src/rev/7587a716e361
branches:  trunk
changeset: 816784:7587a716e361
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Mon Jul 25 01:52:21 2016 +0000

description:
Use KASSERT for checking non-NULL of ifa->ifa_ifp

ifa->ifa_ifp should be always non-NULL, so doing the check only if
DIAGNOSTIC is ok.

diffstat:

 sys/netinet/if_arp.c   |  7 +++----
 sys/netinet6/nd6_nbr.c |  7 +++----
 2 files changed, 6 insertions(+), 8 deletions(-)

diffs (56 lines):

diff -r 157e8d152c56 -r 7587a716e361 sys/netinet/if_arp.c
--- a/sys/netinet/if_arp.c      Mon Jul 25 00:10:38 2016 +0000
+++ b/sys/netinet/if_arp.c      Mon Jul 25 01:52:21 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_arp.c,v 1.217 2016/07/08 04:33:30 ozaki-r Exp $     */
+/*     $NetBSD: if_arp.c,v 1.218 2016/07/25 01:52:21 ozaki-r Exp $     */
 
 /*-
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.217 2016/07/08 04:33:30 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.218 2016/07/25 01:52:21 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1560,8 +1560,7 @@
                    CLLADDR(ifa->ifa_ifp->if_sadl));
                return;
        }
-       if (ifa->ifa_ifp == NULL)
-               panic("arp_dad_start: ifa->ifa_ifp == NULL");
+       KASSERT(ifa->ifa_ifp != NULL);
        if (!(ifa->ifa_ifp->if_flags & IFF_UP))
                return;
        if (arp_dad_find(ifa) != NULL) {
diff -r 157e8d152c56 -r 7587a716e361 sys/netinet6/nd6_nbr.c
--- a/sys/netinet6/nd6_nbr.c    Mon Jul 25 00:10:38 2016 +0000
+++ b/sys/netinet6/nd6_nbr.c    Mon Jul 25 01:52:21 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nd6_nbr.c,v 1.123 2016/07/15 07:40:09 ozaki-r Exp $    */
+/*     $NetBSD: nd6_nbr.c,v 1.124 2016/07/25 01:52:21 ozaki-r Exp $    */
 /*     $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $        */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.123 2016/07/15 07:40:09 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.124 2016/07/25 01:52:21 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1114,8 +1114,7 @@
                rt_newaddrmsg(RTM_NEWADDR, ifa, 0, NULL);
                return;
        }
-       if (ifa->ifa_ifp == NULL)
-               panic("nd6_dad_start: ifa->ifa_ifp == NULL");
+       KASSERT(ifa->ifa_ifp != NULL);
        if (!(ifa->ifa_ifp->if_flags & IFF_UP))
                return;
        if (nd6_dad_find(ifa) != NULL) {



Home | Main Index | Thread Index | Old Index