Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Jul 2010 21:33:18 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r210703 - in head/sys: netinet netinet6
Message-ID:  <201007312133.o6VLXISn099872@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bz
Date: Sat Jul 31 21:33:18 2010
New Revision: 210703
URL: http://svn.freebsd.org/changeset/base/210703

Log:
  Document the mandatory argument to the arptimer() and
  nd6_llinfo_timer() functions with a KASSERT().
  Note: there is no need to return after panic.
  
  In the legacy IP case, only assign the arg after the check,
  in the IPv6 case, remove the extra checks for the table and
  interface as they have to be there unless we freed and forgot
  to cancel the timer.  It doesn't matter anyway as we would
  panic on the NULL pointer deref immediately and the bug is
  elsewhere.
  This unifies the code of both address families to some extend.
  
  Reviewed by:	rwatson
  MFC after:	6 days

Modified:
  head/sys/netinet/if_ether.c
  head/sys/netinet6/nd6.c

Modified: head/sys/netinet/if_ether.c
==============================================================================
--- head/sys/netinet/if_ether.c	Sat Jul 31 21:09:49 2010	(r210702)
+++ head/sys/netinet/if_ether.c	Sat Jul 31 21:33:18 2010	(r210703)
@@ -163,12 +163,10 @@ static void
 arptimer(void *arg)
 {
 	struct ifnet *ifp;
-	struct llentry   *lle = (struct llentry *)arg;
+	struct llentry   *lle;
 
-	if (lle == NULL) {
-		panic("%s: NULL entry!\n", __func__);
-		return;
-	}
+	KASSERT(arg != NULL, ("%s: arg NULL", __func__));
+	lle = (struct llentry *)arg;
 	ifp = lle->lle_tbl->llt_ifp;
 	CURVNET_SET(ifp->if_vnet);
 	IF_AFDATA_LOCK(ifp);

Modified: head/sys/netinet6/nd6.c
==============================================================================
--- head/sys/netinet6/nd6.c	Sat Jul 31 21:09:49 2010	(r210702)
+++ head/sys/netinet6/nd6.c	Sat Jul 31 21:33:18 2010	(r210703)
@@ -446,14 +446,9 @@ nd6_llinfo_timer(void *arg)
 	struct ifnet *ifp;
 	struct nd_ifinfo *ndi = NULL;
 
+	KASSERT(arg != NULL, ("%s: arg NULL", __func__));
 	ln = (struct llentry *)arg;
-	if (ln == NULL) {
-		panic("%s: NULL entry!\n", __func__);
-		return;
-	}
-
-	if ((ifp = ((ln->lle_tbl != NULL) ? ln->lle_tbl->llt_ifp : NULL)) == NULL)
-		panic("ln ifp == NULL");
+	ifp = ln->lle_tbl->llt_ifp;
 
 	CURVNET_SET(ifp->if_vnet);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007312133.o6VLXISn099872>