Module Name:    src
Committed By:   ozaki-r
Date:           Fri Apr 24 03:20:41 UTC 2015

Modified Files:
        src/sys/netinet: ip_icmp.c

Log Message:
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).


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.137 src/sys/netinet/ip_icmp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet/ip_icmp.c
diff -u src/sys/netinet/ip_icmp.c:1.136 src/sys/netinet/ip_icmp.c:1.137
--- src/sys/netinet/ip_icmp.c:1.136	Fri Apr 24 02:56:51 2015
+++ src/sys/netinet/ip_icmp.c	Fri Apr 24 03:20:41 2015
@@ -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 @@ ip_next_mtu(u_int mtu, int dir)	/* XXX *
 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 @@ icmp_mtudisc_timeout(struct rtentry *rt,
 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),

Reply via email to