diff mbox

netfilter: ip_tables: remove useless variable assignment in get_info()

Message ID 20170626223428.GA11614@embeddedgus
State Awaiting Upstream, archived
Delegated to: David Miller
Headers show

Commit Message

Gustavo A. R. Silva June 26, 2017, 10:34 p.m. UTC
Value assigned to variable _ret_ at line 970 is overwritten either at
line 986 or 988, before it can be used. This makes such variable
assignment useless.

Addresses-Coverity-ID: 1226932
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
 net/ipv4/netfilter/ip_tables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Joe Perches June 27, 2017, 2:46 a.m. UTC | #1
On Mon, 2017-06-26 at 17:34 -0500, Gustavo A. R. Silva wrote:
> Value assigned to variable _ret_ at line 970 is overwritten either at
> line 986 or 988, before it can be used. This makes such variable
> assignment useless.
> 
> Addresses-Coverity-ID: 1226932
[]
> diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
[]
> @@ -967,7 +967,7 @@ static int get_info(struct net *net, void __user *user,
>  		struct xt_table_info tmp;
>  
>  		if (compat) {
> -			ret = compat_table_info(private, &tmp);
> +			compat_table_info(private, &tmp);

why isn't it more appropriate to test the return value?

>  			xt_compat_flush_offsets(AF_INET);
>  			private = &tmp;
>  		}
diff mbox

Patch

diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index 2a55a40..648697c 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -967,7 +967,7 @@  static int get_info(struct net *net, void __user *user,
 		struct xt_table_info tmp;
 
 		if (compat) {
-			ret = compat_table_info(private, &tmp);
+			compat_table_info(private, &tmp);
 			xt_compat_flush_offsets(AF_INET);
 			private = &tmp;
 		}