Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet Use KASSERT instead of if & panic



details:   https://anonhg.NetBSD.org/src/rev/cee3cbf68849
branches:  trunk
changeset: 807846:cee3cbf68849
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Fri Apr 24 03:20:41 2015 +0000

description:
Use KASSERT instead of if & panic

rt can be NULL only when programming error (and we sure it cannot for now),
so we can use KASSERT here (i.e., check only if DIAGNOSTIC).

diffstat:

 sys/netinet/ip_icmp.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (40 lines):

diff -r 4744942028d9 -r cee3cbf68849 sys/netinet/ip_icmp.c
--- a/sys/netinet/ip_icmp.c     Fri Apr 24 02:56:51 2015 +0000
+++ b/sys/netinet/ip_icmp.c     Fri Apr 24 03:20:41 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_icmp.c,v 1.136 2015/04/24 02:56:51 ozaki-r Exp $    */
+/*     $NetBSD: ip_icmp.c,v 1.137 2015/04/24 03:20:41 ozaki-r Exp $    */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -94,7 +94,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.136 2015/04/24 02:56:51 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.137 2015/04/24 03:20:41 ozaki-r Exp $");
 
 #include "opt_ipsec.h"
 
@@ -1209,8 +1209,8 @@
 static void
 icmp_mtudisc_timeout(struct rtentry *rt, struct rttimer *r)
 {
-       if (rt == NULL)
-               panic("icmp_mtudisc_timeout:  bad route to timeout");
+       KASSERT(rt != NULL);
+
        if ((rt->rt_flags & (RTF_DYNAMIC | RTF_HOST)) ==
            (RTF_DYNAMIC | RTF_HOST)) {
                rtrequest((int) RTM_DELETE, rt_getkey(rt),
@@ -1225,8 +1225,8 @@
 static void
 icmp_redirect_timeout(struct rtentry *rt, struct rttimer *r)
 {
-       if (rt == NULL)
-               panic("icmp_redirect_timeout:  bad route to timeout");
+       KASSERT(rt != NULL);
+
        if ((rt->rt_flags & (RTF_DYNAMIC | RTF_HOST)) ==
            (RTF_DYNAMIC | RTF_HOST)) {
                rtrequest((int) RTM_DELETE, rt_getkey(rt),



Home | Main Index | Thread Index | Old Index