Hi,

These NULL checks are never reached.  The compiler optimizes away
the first one as m->m_pkthdr dereference m before the check.  All
callers of ipsec_common_input_cb() never call it with NULL as they
dereference m before.

ok?

bluhm

Index: netinet/ipsec_input.c
===================================================================
RCS file: /cvs/src/sys/netinet/ipsec_input.c,v
retrieving revision 1.182
diff -u -p -r1.182 ipsec_input.c
--- netinet/ipsec_input.c       5 Oct 2021 11:45:26 -0000       1.182
+++ netinet/ipsec_input.c       13 Oct 2021 14:49:42 -0000
@@ -203,12 +203,6 @@ ipsec_common_input(struct mbuf *m, int s
        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);
@@ -479,13 +473,6 @@ ipsec_common_input_cb(struct mbuf *m, st
        sproto = tdbp->tdb_sproto;
 
        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) {

Reply via email to