Remove redundant NULL checks in IPsec which are never reached.
authorbluhm <bluhm@openbsd.org>
Wed, 13 Oct 2021 22:49:11 +0000 (22:49 +0000)
committerbluhm <bluhm@openbsd.org>
Wed, 13 Oct 2021 22:49:11 +0000 (22:49 +0000)
ok mvs@

sys/netinet/ipsec_input.c

index 67f9491..94c5a5f 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ipsec_input.c,v 1.183 2021/10/13 22:43:44 bluhm Exp $ */
+/*     $OpenBSD: ipsec_input.c,v 1.184 2021/10/13 22:49:11 bluhm Exp $ */
 /*
  * The authors of this code are John Ioannidis (ji@tla.org),
  * Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -203,12 +203,6 @@ ipsec_common_input(struct mbuf *m, int skip, int protoff, int af, int sproto,
        ipsecstat_pkt(ipsec_ipackets, ipsec_ibytes, m->m_pkthdr.len);
        IPSEC_ISTAT(esps_input, ahs_input, ipcomps_input);
 
-       if (m == NULL) {
-               DPRINTF("NULL packet received");
-               IPSEC_ISTAT(esps_hdrops, ahs_hdrops, ipcomps_hdrops);
-               return EINVAL;
-       }
-
        if ((sproto == IPPROTO_IPCOMP) && (m->m_flags & M_COMP)) {
                DPRINTF("repeated decompression");
                ipcompstat_inc(ipcomps_pdrops);
@@ -476,13 +470,6 @@ ipsec_common_input_cb(struct mbuf *m, struct tdb *tdbp, int skip, int protoff)
 
        tdbp->tdb_last_used = gettime();
 
-       /* Sanity check */
-       if (m == NULL) {
-               /* The called routine will print a message if necessary */
-               IPSEC_ISTAT(esps_badkcr, ahs_badkcr, ipcomps_badkcr);
-               return -1;
-       }
-
        /* Fix IPv4 header */
        if (af == AF_INET) {
                if ((m->m_len < skip) && ((m = m_pullup(m, skip)) == NULL)) {