Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Aug 2014 08:39:48 +0000 (UTC)
From:      "Alexander V. Chernikov" <melifaro@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r269372 - projects/ipfw/sys/netpfil/ipfw
Message-ID:  <201408010839.s718dmon059139@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: melifaro
Date: Fri Aug  1 08:39:47 2014
New Revision: 269372
URL: http://svnweb.freebsd.org/changeset/base/269372

Log:
  Do not perform memset() on ta_buf in algo callbacks:
    it is already zeroed by base code.

Modified:
  projects/ipfw/sys/netpfil/ipfw/ip_fw_table_algo.c

Modified: projects/ipfw/sys/netpfil/ipfw/ip_fw_table_algo.c
==============================================================================
--- projects/ipfw/sys/netpfil/ipfw/ip_fw_table_algo.c	Fri Aug  1 08:28:18 2014	(r269371)
+++ projects/ipfw/sys/netpfil/ipfw/ip_fw_table_algo.c	Fri Aug  1 08:39:47 2014	(r269372)
@@ -266,9 +266,9 @@ ta_foreach_radix(void *ta_state, struct 
 
 struct ta_buf_cidr 
 {
+	void *ent_ptr;
 	struct sockaddr	*addr_ptr;
 	struct sockaddr	*mask_ptr;
-	void *ent_ptr;
 	union {
 		struct {
 			struct sockaddr_in sa;
@@ -352,7 +352,6 @@ ta_prepare_add_cidr(struct ip_fw_chain *
 	int mlen, set_mask;
 
 	tb = (struct ta_buf_cidr *)ta_buf;
-	memset(tb, 0, sizeof(struct ta_buf_cidr));
 
 	mlen = tei->masklen;
 	set_mask = 0;
@@ -460,7 +459,6 @@ ta_prepare_del_cidr(struct ip_fw_chain *
 	int mlen, set_mask;
 
 	tb = (struct ta_buf_cidr *)ta_buf;
-	memset(tb, 0, sizeof(struct ta_buf_cidr));
 
 	mlen = tei->masklen;
 	set_mask = 0;
@@ -1103,7 +1101,6 @@ ta_prepare_add_chash(struct ip_fw_chain 
 	int error;
 
 	tb = (struct ta_buf_chash *)ta_buf;
-	memset(tb, 0, sizeof(struct ta_buf_chash));
 
 	ent = malloc(sizeof(*ent), M_IPFW_TBL, M_WAITOK | M_ZERO);
 
@@ -1196,7 +1193,6 @@ ta_prepare_del_chash(struct ip_fw_chain 
 	struct ta_buf_chash *tb;
 
 	tb = (struct ta_buf_chash *)ta_buf;
-	memset(tb, 0, sizeof(struct ta_buf_chash));
 
 	return (tei_to_chash_ent(tei, &tb->ent));
 }
@@ -1657,7 +1653,6 @@ ta_prepare_add_ifidx(struct ip_fw_chain 
 	struct ifentry *ife;
 
 	tb = (struct ta_buf_ifidx *)ta_buf;
-	memset(tb, 0, sizeof(struct ta_buf_ifidx));
 
 	/* Check if string is terminated */
 	ifname = (char *)tei->paddr;
@@ -1750,7 +1745,6 @@ ta_prepare_del_ifidx(struct ip_fw_chain 
 	char *ifname;
 
 	tb = (struct ta_buf_ifidx *)ta_buf;
-	memset(tb, 0, sizeof(struct ta_buf_ifidx));
 
 	/* Check if string is terminated */
 	ifname = (char *)tei->paddr;
@@ -2179,7 +2173,6 @@ ta_prepare_add_numarray(struct ip_fw_cha
 	struct ta_buf_numarray *tb;
 
 	tb = (struct ta_buf_numarray *)ta_buf;
-	memset(tb, 0, sizeof(*tb));
 
 	tb->na.number = *((uint32_t *)tei->paddr);
 	tb->na.value = tei->value;
@@ -2836,7 +2829,6 @@ ta_prepare_add_fhash(struct ip_fw_chain 
 	int error;
 
 	tb = (struct ta_buf_fhash *)ta_buf;
-	memset(tb, 0, sizeof(struct ta_buf_fhash));
 
 	if (tei->subtype == AF_INET)
 		sz = sizeof(struct fhashentry4);
@@ -2919,7 +2911,6 @@ ta_prepare_del_fhash(struct ip_fw_chain 
 	struct ta_buf_fhash *tb;
 
 	tb = (struct ta_buf_fhash *)ta_buf;
-	memset(tb, 0, sizeof(struct ta_buf_fhash));
 
 	return (tei_to_fhash_ent(tei, &tb->fe6.e));
 }



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