netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org, Fabio <pedretti.fabio@gmail.com>
Subject: [nf-next PATCH 1/2] netfilter: xt_reent: Reduce size of struct recent_entry::nstamps
Date: Thu, 13 Jun 2024 16:32:53 +0200	[thread overview]
Message-ID: <20240613143254.26622-2-phil@nwl.cc> (raw)
In-Reply-To: <20240613143254.26622-1-phil@nwl.cc>

There is no point in this change besides presenting its possibility
separate from a follow-up patch extending the size of both 'index' and
'nstamps' fields.

The value of 'nstamps' is initialized to 1 in recent_entry_init() and
adjusted in recent_entry_update() to match that of 'index' if it becomes
larger after being incremented. Since 'index' is of type u8, it will at
max become 255 (and wrap to 0 afterwards). Therefore, 'nstamps' will
also never exceed the value 255.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 net/netfilter/xt_recent.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c
index ef93e0d3bee0..60259280b2d5 100644
--- a/net/netfilter/xt_recent.c
+++ b/net/netfilter/xt_recent.c
@@ -70,7 +70,7 @@ struct recent_entry {
 	u_int16_t		family;
 	u_int8_t		ttl;
 	u_int8_t		index;
-	u_int16_t		nstamps;
+	u_int8_t		nstamps;
 	unsigned long		stamps[];
 };
 
-- 
2.43.0


  reply	other threads:[~2024-06-13 14:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13 14:32 [nf-next PATCH 0/2] netfilter: xt_recent: Allow for much larger hitcount values Phil Sutter
2024-06-13 14:32 ` Phil Sutter [this message]
2024-06-13 14:32 ` [nf-next PATCH 2/2] netfilter: xt_recent: Largely lift restrictions on max hitcount value Phil Sutter
2024-06-13 14:41   ` Florian Westphal
2024-06-14 10:45     ` Phil Sutter
2024-06-17 17:38   ` kernel test robot

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=20240613143254.26622-2-phil@nwl.cc \
    --to=phil@nwl.cc \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pedretti.fabio@gmail.com \
    /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).