[PATCH] selftests: netfilter: Remove unused variables in conntrack_dump_flush

Qingshuang Fu posted 1 patch 1 month, 3 weeks ago
.../testing/selftests/net/netfilter/conntrack_dump_flush.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
[PATCH] selftests: netfilter: Remove unused variables in conntrack_dump_flush
Posted by Qingshuang Fu 1 month, 3 weeks ago
From: Qingshuang Fu <fuqingshuang@kylinos.cn>

The variables 'rplnlh' in conntrack_data_insert() and 'rplnlh' together
with 'nest' in conntracK_count_zone() and conntrack_flush_zone() were
declared but never used since they were introduced.

Similarly, commit 76342e842587 ("selftests: netfilter: remove unused
parameter") removed the unused 'err' variable from these functions but
overlooked the remaining unused 'rplnlh' and 'nest' variables.  Remove
them to clean up the code.

Fixes: eff3c558bb7e ("netfilter: ctnetlink: support filtering by zone")
Signed-off-by: Qingshuang Fu <fuqingshuang@kylinos.cn>
---
 .../testing/selftests/net/netfilter/conntrack_dump_flush.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/net/netfilter/conntrack_dump_flush.c b/tools/testing/selftests/net/netfilter/conntrack_dump_flush.c
index 5cecb8a1bc94..c8e4794ec5cb 100644
--- a/tools/testing/selftests/net/netfilter/conntrack_dump_flush.c
+++ b/tools/testing/selftests/net/netfilter/conntrack_dump_flush.c
@@ -102,7 +102,6 @@ static int conntrack_data_insert(struct mnl_socket *sock, struct nlmsghdr *nlh,
 				 uint16_t zone)
 {
 	char buf[MNL_SOCKET_BUFFER_SIZE];
-	struct nlmsghdr *rplnlh;
 	unsigned int portid;
 	int ret;
 
@@ -219,9 +218,8 @@ static int count_entries(const struct nlmsghdr *nlh, void *data)
 static int conntracK_count_zone(struct mnl_socket *sock, uint16_t zone)
 {
 	char buf[MNL_SOCKET_BUFFER_SIZE];
-	struct nlmsghdr *nlh, *rplnlh;
+	struct nlmsghdr *nlh;
 	struct nfgenmsg *nfh;
-	struct nlattr *nest;
 	unsigned int portid;
 	int ret;
 
@@ -266,9 +264,8 @@ static int conntracK_count_zone(struct mnl_socket *sock, uint16_t zone)
 static int conntrack_flush_zone(struct mnl_socket *sock, uint16_t zone)
 {
 	char buf[MNL_SOCKET_BUFFER_SIZE];
-	struct nlmsghdr *nlh, *rplnlh;
+	struct nlmsghdr *nlh;
 	struct nfgenmsg *nfh;
-	struct nlattr *nest;
 	unsigned int portid;
 	int ret;
 

base-commit: 0d839570765118029aa8bf4a95444c6a11aacf85
-- 
2.25.1
Re: [PATCH] selftests: netfilter: Remove unused variables in conntrack_dump_flush
Posted by Fernando Fernandez Mancera 1 month, 3 weeks ago
On 8/6/26 9:50 AM, Qingshuang Fu wrote:
> From: Qingshuang Fu <fuqingshuang@kylinos.cn>
> 
> The variables 'rplnlh' in conntrack_data_insert() and 'rplnlh' together
> with 'nest' in conntracK_count_zone() and conntrack_flush_zone() were
> declared but never used since they were introduced.
> 
> Similarly, commit 76342e842587 ("selftests: netfilter: remove unused
> parameter") removed the unused 'err' variable from these functions but
> overlooked the remaining unused 'rplnlh' and 'nest' variables.  Remove
> them to clean up the code.
> 
> Fixes: eff3c558bb7e ("netfilter: ctnetlink: support filtering by zone")
> Signed-off-by: Qingshuang Fu <fuqingshuang@kylinos.cn>
> ---

Thanks for patch, it looks good to me but could we avoid the fixes tag here?

Reviewed-by: Fernando Fernandez Mancera <fmancera@suse.de>
Re: [PATCH] selftests: netfilter: Remove unused variables in conntrack_dump_flush
Posted by Fernando Fernandez Mancera 1 month, 3 weeks ago
On 8/6/26 10:45 AM, Fernando Fernandez Mancera wrote:
> On 8/6/26 9:50 AM, Qingshuang Fu wrote:
>> From: Qingshuang Fu <fuqingshuang@kylinos.cn>
>>
>> The variables 'rplnlh' in conntrack_data_insert() and 'rplnlh' together
>> with 'nest' in conntracK_count_zone() and conntrack_flush_zone() were
>> declared but never used since they were introduced.
>>
>> Similarly, commit 76342e842587 ("selftests: netfilter: remove unused
>> parameter") removed the unused 'err' variable from these functions but
>> overlooked the remaining unused 'rplnlh' and 'nest' variables.  Remove
>> them to clean up the code.
>>
>> Fixes: eff3c558bb7e ("netfilter: ctnetlink: support filtering by zone")
>> Signed-off-by: Qingshuang Fu <fuqingshuang@kylinos.cn>
>> ---
> 
> Thanks for patch, it looks good to me but could we avoid the fixes tag 
> here?
> 
> Reviewed-by: Fernando Fernandez Mancera <fmancera@suse.de>

Actually, since you are at it.. could you also include the following 
diff? Thanks!

--- a/tools/testing/selftests/net/netfilter/conntrack_dump_flush.c
+++ b/tools/testing/selftests/net/netfilter/conntrack_dump_flush.c
@@ -216,7 +216,7 @@ static int count_entries(const struct nlmsghdr *nlh, 
void *data)
         return MNL_CB_OK;
  }

-static int conntracK_count_zone(struct mnl_socket *sock, uint16_t zone)
+static int conntrack_count_zone(struct mnl_socket *sock, uint16_t zone)
  {
         char buf[MNL_SOCKET_BUFFER_SIZE];
         struct nlmsghdr *nlh;