netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux] netfilter: Remove unnecessary ret assignment
@ 2021-12-30  6:31 cgel.zte
  2021-12-30 12:12 ` Florian Westphal
  0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2021-12-30  6:31 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: Jozsef Kadlecsik, Florian Westphal, Hideaki YOSHIFUJI,
	David Ahern, Jakub Kicinski, netfilter-devel, linux-kernel,
	luo penghao, Zeal Robot

From: luo penghao <luo.penghao@zte.com.cn>

Regardless of whether the subsequent (copy_to_user(user, &info, *len) != 0)
holds, the value of ret will be assigned a new value.

The clang_analyzer complains as follows:

net/ipv6/netfilter/ip6_tables.c:

Value stored to 'ret' is never read

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: luo penghao <luo.penghao@zte.com.cn>
---
 net/ipv6/netfilter/ip6_tables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index a579ea1..92b90a2 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -986,7 +986,7 @@ static int get_info(struct net *net, void __user *user, const int *len)
 		struct xt_table_info tmp;
 
 		if (in_compat_syscall()) {
-			ret = compat_table_info(private, &tmp);
+			compat_table_info(private, &tmp);
 			xt_compat_flush_offsets(AF_INET6);
 			private = &tmp;
 		}
-- 
2.15.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH linux] netfilter: Remove unnecessary ret assignment
  2021-12-30  6:31 [PATCH linux] netfilter: Remove unnecessary ret assignment cgel.zte
@ 2021-12-30 12:12 ` Florian Westphal
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Westphal @ 2021-12-30 12:12 UTC (permalink / raw)
  To: cgel.zte
  Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
	Hideaki YOSHIFUJI, David Ahern, Jakub Kicinski, netfilter-devel,
	linux-kernel, luo penghao, Zeal Robot

cgel.zte@gmail.com <cgel.zte@gmail.com> wrote:
> From: luo penghao <luo.penghao@zte.com.cn>
> 
> Regardless of whether the subsequent (copy_to_user(user, &info, *len) != 0)
> holds, the value of ret will be assigned a new value.
> 
> The clang_analyzer complains as follows:
> 
> net/ipv6/netfilter/ip6_tables.c:
> 
> Value stored to 'ret' is never read

Please fix this properly:

1. consider adding error unwinding instead.
2. net/ipv4/netfilter/ip_tables.c has same construct

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-30 12:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-30  6:31 [PATCH linux] netfilter: Remove unnecessary ret assignment cgel.zte
2021-12-30 12:12 ` Florian Westphal

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).