lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20260119063704.12989-1-kshitiz.bartariya@zohomail.in>
Date: Mon, 19 Jan 2026 12:07:04 +0530
From: Kshitiz Bartariya <kshitiz.bartariya@...omail.in>
To: Pablo Neira Ayuso <pablo@...filter.org>,
	Florian Westphal <fw@...len.de>
Cc: Phil Sutter <phil@....cc>,
	"David S . Miller" <davem@...emloft.net>,
	David Ahern <dsahern@...nel.org>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>,
	Simon Horman <horms@...nel.org>,
	netfilter-devel@...r.kernel.org,
	coreteam@...filter.org,
	netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Kshitiz Bartariya <kshitiz.bartariya@...omail.in>
Subject: [PATCH net-next] netfilter: arptables: use xt_entry_foreach() in copy_entries_to_user()

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@...omail.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;
 		if (copy_to_user(userptr + off, e, sizeof(*e))) {
 			ret = -EFAULT;
 			goto free_counters;
@@ -707,6 +706,7 @@ static int copy_entries_to_user(unsigned int total_size,
 			ret = -EFAULT;
 			goto free_counters;
 		}
+		num++;
 	}
 
  free_counters:
-- 
2.50.1 (Apple Git-155)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ