* [PATCH] netfilter: remove unnecessary assignment in translate_table
@ 2024-07-01 11:53 Liu Jing
2024-07-02 9:28 ` Simon Horman
2024-08-19 17:02 ` Pablo Neira Ayuso
0 siblings, 2 replies; 3+ messages in thread
From: Liu Jing @ 2024-07-01 11:53 UTC (permalink / raw)
To: pablo, kadlec, davem, dsahern, edumazet, kuba, pabeni
Cc: netfilter-devel, coreteam, netdev, linux-kernel, Liu Jing
in translate_table, the initialized value of 'ret' is unused,
because it will be assigned in the rear. thus remove it.
Signed-off-by: Liu Jing <liujing@cmss.chinamobile.com>
---
net/ipv4/netfilter/ip_tables.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index fe89a056eb06..c9b34d7d7558 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -664,7 +664,7 @@ translate_table(struct net *net, struct xt_table_info *newinfo, void *entry0,
struct ipt_entry *iter;
unsigned int *offsets;
unsigned int i;
- int ret = 0;
+ int ret;
newinfo->size = repl->size;
newinfo->number = repl->num_entries;
--
2.33.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] netfilter: remove unnecessary assignment in translate_table
2024-07-01 11:53 [PATCH] netfilter: remove unnecessary assignment in translate_table Liu Jing
@ 2024-07-02 9:28 ` Simon Horman
2024-08-19 17:02 ` Pablo Neira Ayuso
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2024-07-02 9:28 UTC (permalink / raw)
To: Liu Jing
Cc: pablo, kadlec, davem, dsahern, edumazet, kuba, pabeni,
netfilter-devel, coreteam, netdev, linux-kernel
On Mon, Jul 01, 2024 at 07:53:02PM +0800, Liu Jing wrote:
> in translate_table, the initialized value of 'ret' is unused,
> because it will be assigned in the rear. thus remove it.
>
> Signed-off-by: Liu Jing <liujing@cmss.chinamobile.com>
Thanks,
I agree that ret is always set before it is used in translate_table(),
and thus the initialisation to 0 accompanying the variable declaration
is unnecessary.
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] netfilter: remove unnecessary assignment in translate_table
2024-07-01 11:53 [PATCH] netfilter: remove unnecessary assignment in translate_table Liu Jing
2024-07-02 9:28 ` Simon Horman
@ 2024-08-19 17:02 ` Pablo Neira Ayuso
1 sibling, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2024-08-19 17:02 UTC (permalink / raw)
To: Liu Jing
Cc: kadlec, davem, dsahern, edumazet, kuba, pabeni, netfilter-devel,
coreteam, netdev, linux-kernel, Simon Horman
On Mon, Jul 01, 2024 at 07:53:02PM +0800, Liu Jing wrote:
> in translate_table, the initialized value of 'ret' is unused,
> because it will be assigned in the rear. thus remove it.
>
> Signed-off-by: Liu Jing <liujing@cmss.chinamobile.com>
> ---
> net/ipv4/netfilter/ip_tables.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
> index fe89a056eb06..c9b34d7d7558 100644
> --- a/net/ipv4/netfilter/ip_tables.c
> +++ b/net/ipv4/netfilter/ip_tables.c
> @@ -664,7 +664,7 @@ translate_table(struct net *net, struct xt_table_info *newinfo, void *entry0,
> struct ipt_entry *iter;
> unsigned int *offsets;
> unsigned int i;
> - int ret = 0;
> + int ret;
ip6_tables is a copy&paste from ip_tables, so it is arp_tables.
I think all of them have the same unnecessary initialization.
Would you still post v2?
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-19 17:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-01 11:53 [PATCH] netfilter: remove unnecessary assignment in translate_table Liu Jing
2024-07-02 9:28 ` Simon Horman
2024-08-19 17:02 ` Pablo Neira Ayuso
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).