diff mbox series

[net/ipv6] Remove redundant null check in ah_mt6

Message ID 20200625023626.32557-1-gaurav1086@gmail.com
State New
Headers show
Series [net/ipv6] Remove redundant null check in ah_mt6 | expand

Commit Message

Gaurav Singh June 25, 2020, 2:36 a.m. UTC
ah cannot be NULL since its already checked above after
assignment and is being dereferenced before in pr().
Remove the redundant null check.

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
---
 net/ipv6/netfilter/ip6t_ah.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Pablo Neira Ayuso July 4, 2020, 12:07 a.m. UTC | #1
Hi Gaurav,

On Wed, Jun 24, 2020 at 10:36:25PM -0400, Gaurav Singh wrote:
> ah cannot be NULL since its already checked above after

> assignment and is being dereferenced before in pr().

> Remove the redundant null check.


Could you collapse all your patches into one?

They look like the same logic change (patch description is the same in
the four patches in the series).

Please, prepend netfilter: to your patch subject, I suggest the
following subject for the collapsed patch.

        netfilter: ip6tables: Remove redundant null checks

Thanks.
Pablo Neira Ayuso July 29, 2020, 8:44 p.m. UTC | #2
Applied, thanks.
diff mbox series

Patch

diff --git a/net/ipv6/netfilter/ip6t_ah.c b/net/ipv6/netfilter/ip6t_ah.c
index 4e15a14435e4..70da2f2ce064 100644
--- a/net/ipv6/netfilter/ip6t_ah.c
+++ b/net/ipv6/netfilter/ip6t_ah.c
@@ -74,8 +74,7 @@  static bool ah_mt6(const struct sk_buff *skb, struct xt_action_param *par)
 		 ahinfo->hdrres, ah->reserved,
 		 !(ahinfo->hdrres && ah->reserved));
 
-	return (ah != NULL) &&
-		spi_match(ahinfo->spis[0], ahinfo->spis[1],
+	return spi_match(ahinfo->spis[0], ahinfo->spis[1],
 			  ntohl(ah->spi),
 			  !!(ahinfo->invflags & IP6T_AH_INV_SPI)) &&
 		(!ahinfo->hdrlen ||