From nobody Sun Feb 8 19:21:02 2026 Received: from sender-pp-o93.zoho.in (sender-pp-o93.zoho.in [103.117.158.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B94B1339B1 for ; Mon, 19 Jan 2026 06:39:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=103.117.158.93 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768804749; cv=pass; b=I0qzGF5+HuJEXu9BAV1nUZXYuGJtI8Do0UXri4XIM/P+RmoLzker5yWODaQDVHqiqccmgig2NkJEZAAZFuGsBwreSLZZtghscQzFrtJjyxhQcz6SzC8Q9rMrSG4jPhfY47e+PTCeRAt16bNGTZ973zsukcr2rbzganDlzZ5U5iE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768804749; c=relaxed/simple; bh=fEhaqK+fzB5PHZVmOyCZRiBx7k/3CMNRhcpPDuhfbYo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=CvftbS5fQFH+y3A/n/4z3PcEsElEnsBl+4vj7/e6712j4BUfYHBIrr8XRCy+Wbmq/NcFvHDemF5eZKKY+JrKJpdIrGee2aXrqYD1kwFuTd6lzSCBDi7t4bV+FXdb3JQEo5gMrMS4XIj11kUDqzuYb2KcALQDv7cqy1lUxJCim1g= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=zohomail.in; spf=pass smtp.mailfrom=zohomail.in; dkim=pass (1024-bit key) header.d=zohomail.in header.i=kshitiz.bartariya@zohomail.in header.b=OaV/p7Vz; arc=pass smtp.client-ip=103.117.158.93 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=zohomail.in Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zohomail.in Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=zohomail.in header.i=kshitiz.bartariya@zohomail.in header.b="OaV/p7Vz" ARC-Seal: i=1; a=rsa-sha256; t=1768804668; cv=none; d=zohomail.in; s=zohoarc; b=eH67j+FiWu1bq90lddCqF7Pah0xd7vPXwrpu2s1TtWd2+VLux78plPlewUDltStc1i74/W7eXz7r+zqHqgPKnqfADMfBJCJ8l3h8bTmIZENI5dEljRS5e4xNn0F0ZKAjcanK/EaXwObLV+D9SlGRdHABxJ2EOuKDdJ/cWQEHKCA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.in; s=zohoarc; t=1768804668; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=S1DYyxhh8r1LOgubjCvsaO9OllBcKvtcT+22BlOLsTI=; b=Ny7Ql9UHFAmdH0mf0W3z+KO/jFg2Rz8518Bav11gVuXfICKp10e3Mozi0rzcU5HOPCbQ7dImJ+zZCCBEnD/ku7j6uKR98rGSFfL8kglkLIwDaK27KPBaoN1xelmbIKiHxpsh+jCiwQctSqQXkbHfb4utSlNV1yK+Lg19KKYF4C0= ARC-Authentication-Results: i=1; mx.zohomail.in; dkim=pass header.i=zohomail.in; spf=pass smtp.mailfrom=kshitiz.bartariya@zohomail.in; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1768804668; s=zoho; d=zohomail.in; i=kshitiz.bartariya@zohomail.in; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=S1DYyxhh8r1LOgubjCvsaO9OllBcKvtcT+22BlOLsTI=; b=OaV/p7VzBXviFAWMUZGBYczvKVsn4DcSUicktZ1QKVeOw9zjziYVOfUmPr+pVDOk lrVRWIDmvRQSzLzXRdWf3doLiNfLmMGonoXynJJRgfag3LEbqiGN1D22xV1ic0dPmKZ Ec+4oJJlLXik8Wl3hKrBq5zthG/JDyRMLi7GVg1k= Received: by mx.zoho.in with SMTPS id 1768804661659312.3357861596362; Mon, 19 Jan 2026 12:07:41 +0530 (IST) From: Kshitiz Bartariya To: Pablo Neira Ayuso , Florian Westphal Cc: Phil Sutter , "David S . Miller" , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Kshitiz Bartariya Subject: [PATCH net-next] netfilter: arptables: use xt_entry_foreach() in copy_entries_to_user() Date: Mon, 19 Jan 2026 12:07:04 +0530 Message-ID: <20260119063704.12989-1-kshitiz.bartariya@zohomail.in> X-Mailer: git-send-email 2.50.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" 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 --- 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_table= s.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_si= ze, =20 loc_cpu_entry =3D private->entries; =20 - /* FIXME: use iterator macros --RR */ - /* ... then go back and fix counters and names */ - for (off =3D 0, num =3D 0; off < total_size; off +=3D e->next_offset, num= ++){ + num =3D 0; + xt_entry_foreach(e, loc_cpu_entry, total_size) { const struct xt_entry_target *t; =20 - e =3D loc_cpu_entry + off; + off =3D (unsigned char *)e - (unsigned char *)loc_cpu_entry; if (copy_to_user(userptr + off, e, sizeof(*e))) { ret =3D -EFAULT; goto free_counters; @@ -707,6 +706,7 @@ static int copy_entries_to_user(unsigned int total_size, ret =3D -EFAULT; goto free_counters; } + num++; } =20 free_counters: --=20 2.50.1 (Apple Git-155)