From: Florian Westphal <fw@strlen.de>
To: Simon Horman <horms@kernel.org>
Cc: Kshitiz Bartariya <kshitiz.bartariya@zohomail.in>,
Pablo Neira Ayuso <pablo@netfilter.org>,
Phil Sutter <phil@nwl.cc>,
"David S . Miller" <davem@davemloft.net>,
David Ahern <dsahern@kernel.org>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] netfilter: arptables: use xt_entry_foreach() in copy_entries_to_user()
Date: Wed, 21 Jan 2026 23:05:21 +0100 [thread overview]
Message-ID: <aXFNoRjTS71iqDDQ@strlen.de> (raw)
In-Reply-To: <aXERRqh79pmVsuzk@horms.kernel.org>
Simon Horman <horms@kernel.org> wrote:
> On Mon, Jan 19, 2026 at 12:07:04PM +0530, Kshitiz Bartariya wrote:
> > Replace the manual offset-based iteration with xt_entry_foreach(),
> > thereby removing FIXME. The byte offset semantics and user ABI
> > are preserved.
> >
> > Signed-off-by: Kshitiz Bartariya <kshitiz.bartariya@zohomail.in>
> > ---
> > net/ipv4/netfilter/arp_tables.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
> > index 1cdd9c28ab2d..9f82ce0fcaa5 100644
> > --- a/net/ipv4/netfilter/arp_tables.c
> > +++ b/net/ipv4/netfilter/arp_tables.c
> > @@ -684,12 +684,11 @@ static int copy_entries_to_user(unsigned int total_size,
> >
> > loc_cpu_entry = private->entries;
> >
> > - /* FIXME: use iterator macros --RR */
> > - /* ... then go back and fix counters and names */
> > - for (off = 0, num = 0; off < total_size; off += e->next_offset, num++){
> > + num = 0;
> > + xt_entry_foreach(e, loc_cpu_entry, total_size) {
> > const struct xt_entry_target *t;
> >
> > - e = loc_cpu_entry + off;
> > + off = (unsigned char *)e - (unsigned char *)loc_cpu_entry;
>
> This offset calculation makes me feel queasy.
>
> Can the code start with off = 0 and increment it by e->next_offset
> as the loop iterates, as was the case before this patch?
> It would be similar to how num is handled.
I think this file should just be left alone resp. should be restricted
to bug fixes only. Same for ip/ip6/ebtables.
Its too early to remove this file from the tree, but I don't see
value in making cosmetic improvements, sorry.
next prev parent reply other threads:[~2026-01-21 22:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-19 6:37 [PATCH net-next] netfilter: arptables: use xt_entry_foreach() in copy_entries_to_user() Kshitiz Bartariya
2026-01-21 17:47 ` Simon Horman
2026-01-21 22:05 ` Florian Westphal [this message]
2026-01-22 8:15 ` Simon Horman
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=aXFNoRjTS71iqDDQ@strlen.de \
--to=fw@strlen.de \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kshitiz.bartariya@zohomail.in \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=phil@nwl.cc \
/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