netfilter: ip6tables: Remove redundant null checks

Remove superfluous check for NULL pointer to header.

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
Gaurav Singh 2020-07-26 21:52:05 -04:00 committed by Pablo Neira Ayuso
parent 50935339c3
commit 42f36eba71
4 changed files with 4 additions and 8 deletions

View File

@ -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,
!(ahinfo->hdrres && ah->reserved)); !(ahinfo->hdrres && ah->reserved));
return (ah != NULL) && return spi_match(ahinfo->spis[0], ahinfo->spis[1],
spi_match(ahinfo->spis[0], ahinfo->spis[1],
ntohl(ah->spi), ntohl(ah->spi),
!!(ahinfo->invflags & IP6T_AH_INV_SPI)) && !!(ahinfo->invflags & IP6T_AH_INV_SPI)) &&
(!ahinfo->hdrlen || (!ahinfo->hdrlen ||

View File

@ -85,8 +85,7 @@ frag_mt6(const struct sk_buff *skb, struct xt_action_param *par)
!((fraginfo->flags & IP6T_FRAG_NMF) && !((fraginfo->flags & IP6T_FRAG_NMF) &&
(ntohs(fh->frag_off) & IP6_MF))); (ntohs(fh->frag_off) & IP6_MF)));
return (fh != NULL) && return id_match(fraginfo->ids[0], fraginfo->ids[1],
id_match(fraginfo->ids[0], fraginfo->ids[1],
ntohl(fh->identification), ntohl(fh->identification),
!!(fraginfo->invflags & IP6T_FRAG_INV_IDS)) && !!(fraginfo->invflags & IP6T_FRAG_INV_IDS)) &&
!((fraginfo->flags & IP6T_FRAG_RES) && !((fraginfo->flags & IP6T_FRAG_RES) &&

View File

@ -86,8 +86,7 @@ hbh_mt6(const struct sk_buff *skb, struct xt_action_param *par)
((optinfo->hdrlen == hdrlen) ^ ((optinfo->hdrlen == hdrlen) ^
!!(optinfo->invflags & IP6T_OPTS_INV_LEN)))); !!(optinfo->invflags & IP6T_OPTS_INV_LEN))));
ret = (oh != NULL) && ret = (!(optinfo->flags & IP6T_OPTS_LEN) ||
(!(optinfo->flags & IP6T_OPTS_LEN) ||
((optinfo->hdrlen == hdrlen) ^ ((optinfo->hdrlen == hdrlen) ^
!!(optinfo->invflags & IP6T_OPTS_INV_LEN))); !!(optinfo->invflags & IP6T_OPTS_INV_LEN)));

View File

@ -89,8 +89,7 @@ static bool rt_mt6(const struct sk_buff *skb, struct xt_action_param *par)
!((rtinfo->flags & IP6T_RT_RES) && !((rtinfo->flags & IP6T_RT_RES) &&
(((const struct rt0_hdr *)rh)->reserved))); (((const struct rt0_hdr *)rh)->reserved)));
ret = (rh != NULL) && ret = (segsleft_match(rtinfo->segsleft[0], rtinfo->segsleft[1],
(segsleft_match(rtinfo->segsleft[0], rtinfo->segsleft[1],
rh->segments_left, rh->segments_left,
!!(rtinfo->invflags & IP6T_RT_INV_SGS))) && !!(rtinfo->invflags & IP6T_RT_INV_SGS))) &&
(!(rtinfo->flags & IP6T_RT_LEN) || (!(rtinfo->flags & IP6T_RT_LEN) ||