diff mbox series

netfilter: nf_tables: remove redundant assignment of variable err

Message ID 20210128175923.645865-1-colin.king@canonical.com
State New
Headers show
Series netfilter: nf_tables: remove redundant assignment of variable err | expand

Commit Message

Colin King Jan. 28, 2021, 5:59 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The variable err is being assigned a value that is never read,
the same error number is being returned at the error return
path via label err1.  Clean up the code by removing the assignment.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 net/netfilter/nft_cmp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Pablo Neira Ayuso Feb. 3, 2021, 11:04 p.m. UTC | #1
On Thu, Jan 28, 2021 at 05:59:23PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>

> 

> The variable err is being assigned a value that is never read,

> the same error number is being returned at the error return

> path via label err1.  Clean up the code by removing the assignment.


Applied to nf, thanks.
Pablo Neira Ayuso Feb. 3, 2021, 11:58 p.m. UTC | #2
On Thu, Feb 04, 2021 at 12:04:21AM +0100, Pablo Neira Ayuso wrote:
> On Thu, Jan 28, 2021 at 05:59:23PM +0000, Colin King wrote:

> > From: Colin Ian King <colin.king@canonical.com>

> > 

> > The variable err is being assigned a value that is never read,

> > the same error number is being returned at the error return

> > path via label err1.  Clean up the code by removing the assignment.

> 

> Applied to nf, thanks.


Sorry, I meant, nf-next
diff mbox series

Patch

diff --git a/net/netfilter/nft_cmp.c b/net/netfilter/nft_cmp.c
index 00e563a72d3d..acbabffefebb 100644
--- a/net/netfilter/nft_cmp.c
+++ b/net/netfilter/nft_cmp.c
@@ -268,10 +268,8 @@  nft_cmp_select_ops(const struct nft_ctx *ctx, const struct nlattr * const tb[])
 	if (err < 0)
 		return ERR_PTR(err);
 
-	if (desc.type != NFT_DATA_VALUE) {
-		err = -EINVAL;
+	if (desc.type != NFT_DATA_VALUE)
 		goto err1;
-	}
 
 	if (desc.len <= sizeof(u32) && (op == NFT_CMP_EQ || op == NFT_CMP_NEQ))
 		return &nft_cmp_fast_ops;