2021-04-30 09:28:12

by Yang Li

[permalink] [raw]
Subject: [PATCH] netfilter: Remove redundant assignment to ret

Variable 'ret' is set to zero but this value is never read as it is
overwritten with a new value later on, hence it is a redundant
assignment and can be removed

Clean up the following clang-analyzer warning:

net/netfilter/xt_CT.c:175:2: warning: Value stored to 'ret' is never
read [clang-analyzer-deadcode.DeadStores]

Reported-by: Abaci Robot <[email protected]>
Signed-off-by: Yang Li <[email protected]>
---
net/netfilter/xt_CT.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/net/netfilter/xt_CT.c b/net/netfilter/xt_CT.c
index d4deee39..12404d2 100644
--- a/net/netfilter/xt_CT.c
+++ b/net/netfilter/xt_CT.c
@@ -172,7 +172,6 @@ static int xt_ct_tg_check(const struct xt_tgchk_param *par,
goto err2;
}

- ret = 0;
if ((info->ct_events || info->exp_events) &&
!nf_ct_ecache_ext_add(ct, info->ct_events, info->exp_events,
GFP_KERNEL)) {
--
1.8.3.1


2021-05-27 19:08:02

by Pablo Neira Ayuso

[permalink] [raw]
Subject: Re: [PATCH] netfilter: Remove redundant assignment to ret

On Fri, Apr 30, 2021 at 05:25:10PM +0800, Yang Li wrote:
> Variable 'ret' is set to zero but this value is never read as it is
> overwritten with a new value later on, hence it is a redundant
> assignment and can be removed
>
> Clean up the following clang-analyzer warning:
>
> net/netfilter/xt_CT.c:175:2: warning: Value stored to 'ret' is never
> read [clang-analyzer-deadcode.DeadStores]

I overlook this small patch, now applied to nf-next. Thanks.