git: 60a28b091651 - main - ipfw: plug set-but-not-used vars

From: Mateusz Guzik <mjg_at_FreeBSD.org>
Date: Sat, 18 Dec 2021 13:21:24 UTC
The branch main has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=60a28b091651d7cdea9d57862d2535c1f33c4be3

commit 60a28b091651d7cdea9d57862d2535c1f33c4be3
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2021-12-18 13:21:03 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2021-12-18 13:21:03 +0000

    ipfw: plug set-but-not-used vars
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 sys/netpfil/ipfw/ip_fw_sockopt.c    |  6 +-----
 sys/netpfil/ipfw/ip_fw_table.c      |  7 +++----
 sys/netpfil/ipfw/ip_fw_table_algo.c | 16 ++++------------
 3 files changed, 8 insertions(+), 21 deletions(-)

diff --git a/sys/netpfil/ipfw/ip_fw_sockopt.c b/sys/netpfil/ipfw/ip_fw_sockopt.c
index ee057b4d8346..2658c371091d 100644
--- a/sys/netpfil/ipfw/ip_fw_sockopt.c
+++ b/sys/netpfil/ipfw/ip_fw_sockopt.c
@@ -2833,7 +2833,6 @@ rewrite_rule_uidx(struct ip_fw_chain *chain, struct rule_check_info *ci)
 {
 	int error;
 	ipfw_insn *cmd;
-	uint8_t type;
 	struct obj_idx *p, *pidx_first, *pidx_last;
 	struct tid_info ti;
 
@@ -2850,7 +2849,6 @@ rewrite_rule_uidx(struct ip_fw_chain *chain, struct rule_check_info *ci)
 		    M_IPFW, M_WAITOK | M_ZERO);
 
 	error = 0;
-	type = 0;
 	memset(&ti, 0, sizeof(ti));
 
 	/* Use set rule is assigned to. */
@@ -3792,7 +3790,7 @@ ipfw_ctl(struct sockopt *sopt)
 {
 #define	RULE_MAXSIZE	(512*sizeof(u_int32_t))
 	int error;
-	size_t size, valsize;
+	size_t size;
 	struct ip_fw *buf;
 	struct ip_fw_rule0 *rule;
 	struct ip_fw_chain *chain;
@@ -3804,8 +3802,6 @@ ipfw_ctl(struct sockopt *sopt)
 	chain = &V_layer3_chain;
 	error = 0;
 
-	/* Save original valsize before it is altered via sooptcopyin() */
-	valsize = sopt->sopt_valsize;
 	opt = sopt->sopt_name;
 
 	/*
diff --git a/sys/netpfil/ipfw/ip_fw_table.c b/sys/netpfil/ipfw/ip_fw_table.c
index 6d472029c4bd..19bedbbe9b50 100644
--- a/sys/netpfil/ipfw/ip_fw_table.c
+++ b/sys/netpfil/ipfw/ip_fw_table.c
@@ -355,7 +355,7 @@ rollback_added_entries(struct ip_fw_chain *ch, struct table_config *tc,
 	struct tentry_info *ptei;
 	caddr_t v, vv;
 	size_t ta_buf_sz;
-	int error, i;
+	int error __diagused, i;
 	uint32_t num;
 
 	IPFW_UH_WLOCK_ASSERT(ch);
@@ -482,7 +482,7 @@ flush_batch_buffer(struct ip_fw_chain *ch, struct table_algo *ta,
 static void
 rollback_add_entry(void *object, struct op_state *_state)
 {
-	struct ip_fw_chain *ch;
+	struct ip_fw_chain *ch __diagused;
 	struct tableop_state *ts;
 
 	ts = (struct tableop_state *)_state;
@@ -1537,7 +1537,7 @@ roundup2p(uint32_t v)
 int
 ipfw_resize_tables(struct ip_fw_chain *ch, unsigned int ntables)
 {
-	unsigned int ntables_old, tbl;
+	unsigned int tbl;
 	struct namedobj_instance *ni;
 	void *new_idx, *old_tablestate, *tablestate;
 	struct table_info *ti;
@@ -1583,7 +1583,6 @@ ipfw_resize_tables(struct ip_fw_chain *ch, unsigned int ntables)
 	ch->tablestate = tablestate;
 	ipfw_objhash_bitmap_swap(ni, &new_idx, &new_blocks);
 
-	ntables_old = V_fw_tables_max;
 	V_fw_tables_max = ntables;
 
 	IPFW_WUNLOCK(ch);
diff --git a/sys/netpfil/ipfw/ip_fw_table_algo.c b/sys/netpfil/ipfw/ip_fw_table_algo.c
index 25a4ae1d6a0b..cc5cba386ace 100644
--- a/sys/netpfil/ipfw/ip_fw_table_algo.c
+++ b/sys/netpfil/ipfw/ip_fw_table_algo.c
@@ -2279,11 +2279,8 @@ static int
 ta_prepare_del_ifidx(struct ip_fw_chain *ch, struct tentry_info *tei,
     void *ta_buf)
 {
-	struct ta_buf_ifidx *tb;
 	char *ifname;
 
-	tb = (struct ta_buf_ifidx *)ta_buf;
-
 	/* Check if string is terminated */
 	ifname = (char *)tei->paddr;
 	if (strnlen(ifname, IF_NAMESIZE) == IF_NAMESIZE)
@@ -2305,7 +2302,7 @@ ta_del_ifidx(void *ta_state, struct table_info *ti, struct tentry_info *tei,
 	struct ta_buf_ifidx *tb;
 	char *ifname;
 	uint16_t ifindex;
-	int res;
+	int res __diagused;
 
 	tb = (struct ta_buf_ifidx *)ta_buf;
 	ifname = (char *)tei->paddr;
@@ -2371,7 +2368,7 @@ if_notifier(struct ip_fw_chain *ch, void *cbdata, uint16_t ifindex)
 	struct ifidx ifi;
 	struct iftable_cfg *icfg;
 	struct table_info *ti;
-	int res;
+	int res __diagused;
 
 	ife = (struct ifentry *)cbdata;
 	icfg = ife->icfg;
@@ -2781,7 +2778,7 @@ ta_add_numarray(void *ta_state, struct table_info *ti, struct tentry_info *tei,
 	struct numarray_cfg *cfg;
 	struct ta_buf_numarray *tb;
 	struct numarray *ri;
-	int res;
+	int res __diagused;
 	uint32_t value;
 
 	tb = (struct ta_buf_numarray *)ta_buf;
@@ -2831,7 +2828,7 @@ ta_del_numarray(void *ta_state, struct table_info *ti, struct tentry_info *tei,
 	struct numarray_cfg *cfg;
 	struct ta_buf_numarray *tb;
 	struct numarray *ri;
-	int res;
+	int res __diagused;
 
 	tb = (struct ta_buf_numarray *)ta_buf;
 	cfg = (struct numarray_cfg *)ta_state;
@@ -2981,11 +2978,8 @@ static int
 ta_find_numarray_tentry(void *ta_state, struct table_info *ti,
     ipfw_obj_tentry *tent)
 {
-	struct numarray_cfg *cfg;
 	struct numarray *ri;
 
-	cfg = (struct numarray_cfg *)ta_state;
-
 	ri = numarray_find(ti, &tent->k.key);
 
 	if (ri != NULL) {
@@ -3343,7 +3337,6 @@ static int
 ta_dump_fhash_tentry(void *ta_state, struct table_info *ti, void *e,
     ipfw_obj_tentry *tent)
 {
-	struct fhash_cfg *cfg;
 	struct fhashentry *ent;
 	struct fhashentry4 *fe4;
 #ifdef INET6
@@ -3351,7 +3344,6 @@ ta_dump_fhash_tentry(void *ta_state, struct table_info *ti, void *e,
 #endif
 	struct tflow_entry *tfe;
 
-	cfg = (struct fhash_cfg *)ta_state;
 	ent = (struct fhashentry *)e;
 	tfe = &tent->k.flow;