[lvc-project] [PATCH] netfilter: ebtables: remove unnecessary NULL check

From: Igor Artemiev
Date: Tue Jun 20 2023 - 11:35:03 EST


In ebt_do_table() 'private->chainstack' cannot be NULL
and the 'cs' pointer is dereferenced below, so it does not make
sense to compare 'private->chainstack' with NULL.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Igor Artemiev <Igor.A.Artemiev@xxxxxxx>
---
net/bridge/netfilter/ebtables.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index 757ec46fc45a..74daca8a5142 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -212,10 +212,7 @@ unsigned int ebt_do_table(void *priv, struct sk_buff *skb,
private = table->private;
cb_base = COUNTER_BASE(private->counters, private->nentries,
smp_processor_id());
- if (private->chainstack)
- cs = private->chainstack[smp_processor_id()];
- else
- cs = NULL;
+ cs = private->chainstack[smp_processor_id()];
chaininfo = private->hook_entry[hook];
nentries = private->hook_entry[hook]->nentries;
point = (struct ebt_entry *)(private->hook_entry[hook]->data);
--
2.30.2