netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Florian Westphal <fwestpha@redhat.com>
Cc: netfilter-devel@vger.kernel.org
Subject: [iptables PATCH] nft-bridge: Drop 'sreg_count' variable
Date: Wed, 28 Sep 2022 19:18:39 +0200	[thread overview]
Message-ID: <20220928171839.23522-1-phil@nwl.cc> (raw)

It is not needed, one can just use 'reg' function parameter in its
place.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 iptables/nft-bridge.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/iptables/nft-bridge.c b/iptables/nft-bridge.c
index 596dfdf8991f1..d1385cc3593b9 100644
--- a/iptables/nft-bridge.c
+++ b/iptables/nft-bridge.c
@@ -324,7 +324,6 @@ static int lookup_analyze_payloads(struct nft_xt_ctx *ctx,
 				   bool *dst, bool *ip)
 {
 	const struct nft_xt_ctx_reg *reg;
-	uint32_t sreg_count;
 	int val, val2 = -1;
 
 	reg = nft_xt_ctx_get_sreg(ctx, sreg);
@@ -336,7 +335,6 @@ static int lookup_analyze_payloads(struct nft_xt_ctx *ctx,
 		return -1;
 	}
 
-	sreg_count = sreg;
 	switch (key_len) {
 	case 12: /* ether + ipv4addr */
 		val = lookup_check_ether_payload(reg->payload.base,
@@ -349,9 +347,9 @@ static int lookup_analyze_payloads(struct nft_xt_ctx *ctx,
 			return -1;
 		}
 
-		sreg_count = nft_get_next_reg(sreg_count, ETH_ALEN);
+		sreg = nft_get_next_reg(sreg, ETH_ALEN);
 
-		reg = nft_xt_ctx_get_sreg(ctx, sreg_count);
+		reg = nft_xt_ctx_get_sreg(ctx, sreg);
 		if (!reg) {
 			ctx->errmsg = "next lookup register is invalid";
 			return -1;
-- 
2.34.1


             reply	other threads:[~2022-09-28 17:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28 17:18 Phil Sutter [this message]
2022-09-28 17:55 ` [iptables PATCH] nft-bridge: Drop 'sreg_count' variable Florian Westphal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220928171839.23522-1-phil@nwl.cc \
    --to=phil@nwl.cc \
    --cc=fwestpha@redhat.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).