Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netipsec Don't bother the case of crp->crp_buf == NULL i...



details:   https://anonhg.NetBSD.org/src/rev/a9c2b281674f
branches:  trunk
changeset: 825518:a9c2b281674f
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Wed Jul 19 09:38:57 2017 +0000

description:
Don't bother the case of crp->crp_buf == NULL in callbacks

diffstat:

 sys/netipsec/xform_ah.c     |  19 ++-----------------
 sys/netipsec/xform_esp.c    |  18 ++----------------
 sys/netipsec/xform_ipcomp.c |  20 ++++----------------
 3 files changed, 8 insertions(+), 49 deletions(-)

diffs (141 lines):

diff -r 28f4c9f0fa28 -r a9c2b281674f sys/netipsec/xform_ah.c
--- a/sys/netipsec/xform_ah.c   Wed Jul 19 09:03:52 2017 +0000
+++ b/sys/netipsec/xform_ah.c   Wed Jul 19 09:38:57 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xform_ah.c,v 1.63 2017/07/19 09:03:08 ozaki-r Exp $    */
+/*     $NetBSD: xform_ah.c,v 1.64 2017/07/19 09:38:57 ozaki-r Exp $    */
 /*     $FreeBSD: src/sys/netipsec/xform_ah.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $   */
 /*     $OpenBSD: ip_ah.c,v 1.63 2001/06/26 06:18:58 angelos Exp $ */
 /*
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.63 2017/07/19 09:03:08 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.64 2017/07/19 09:38:57 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -845,14 +845,6 @@
                crp = NULL;
        }
 
-       /* Shouldn't happen... */
-       if (m == NULL) {
-               AH_STATINC(AH_STAT_CRYPTO);
-               DPRINTF(("%s: bogus returned buffer from crypto\n", __func__));
-               error = EINVAL;
-               goto bad;
-       }
-
        /* Figure out header size. */
        rplen = HDRSIZE(sav);
        authsize = AUTHSIZE(sav);
@@ -1220,13 +1212,6 @@
                goto bad;
        }
 
-       /* Shouldn't happen... */
-       if (m == NULL) {
-               AH_STATINC(AH_STAT_CRYPTO);
-               DPRINTF(("%s: bogus returned buffer from crypto\n", __func__));
-               error = EINVAL;
-               goto bad;
-       }
        AH_STATINC(AH_STAT_HIST + ah_stats[sav->alg_auth]);
 
        /*
diff -r 28f4c9f0fa28 -r a9c2b281674f sys/netipsec/xform_esp.c
--- a/sys/netipsec/xform_esp.c  Wed Jul 19 09:03:52 2017 +0000
+++ b/sys/netipsec/xform_esp.c  Wed Jul 19 09:38:57 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xform_esp.c,v 1.63 2017/07/19 09:03:08 ozaki-r Exp $   */
+/*     $NetBSD: xform_esp.c,v 1.64 2017/07/19 09:38:57 ozaki-r Exp $   */
 /*     $FreeBSD: src/sys/netipsec/xform_esp.c,v 1.2.2.1 2003/01/24 05:11:36 sam Exp $  */
 /*     $OpenBSD: ip_esp.c,v 1.69 2001/06/26 06:18:59 angelos Exp $ */
 
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.63 2017/07/19 09:03:08 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.64 2017/07/19 09:38:57 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -554,13 +554,6 @@
                goto bad;
        }
 
-       /* Shouldn't happen... */
-       if (m == NULL) {
-               ESP_STATINC(ESP_STAT_CRYPTO);
-               DPRINTF(("%s: bogus returned buffer from crypto\n", __func__));
-               error = EINVAL;
-               goto bad;
-       }
        ESP_STATINC(ESP_STAT_HIST + esp_stats[sav->alg_enc]);
 
        /* If authentication was performed, check now. */
@@ -998,13 +991,6 @@
                goto bad;
        }
 
-       /* Shouldn't happen... */
-       if (m == NULL) {
-               ESP_STATINC(ESP_STAT_CRYPTO);
-               DPRINTF(("%s: bogus returned buffer from crypto\n", __func__));
-               error = EINVAL;
-               goto bad;
-       }
        ESP_STATINC(ESP_STAT_HIST + esp_stats[sav->alg_enc]);
        if (sav->tdb_authalgxform != NULL)
                AH_STATINC(AH_STAT_HIST + ah_stats[sav->alg_auth]);
diff -r 28f4c9f0fa28 -r a9c2b281674f sys/netipsec/xform_ipcomp.c
--- a/sys/netipsec/xform_ipcomp.c       Wed Jul 19 09:03:52 2017 +0000
+++ b/sys/netipsec/xform_ipcomp.c       Wed Jul 19 09:38:57 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xform_ipcomp.c,v 1.44 2017/07/19 09:03:08 ozaki-r Exp $        */
+/*     $NetBSD: xform_ipcomp.c,v 1.45 2017/07/19 09:38:57 ozaki-r Exp $        */
 /*     $FreeBSD: src/sys/netipsec/xform_ipcomp.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $       */
 /* $OpenBSD: ip_ipcomp.c,v 1.1 2001/07/05 12:08:52 jjbg Exp $ */
 
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xform_ipcomp.c,v 1.44 2017/07/19 09:03:08 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ipcomp.c,v 1.45 2017/07/19 09:38:57 ozaki-r Exp $");
 
 /* IP payload compression protocol (IPComp), see RFC 2393 */
 #if defined(_KERNEL_OPT)
@@ -290,13 +290,7 @@
                error = crp->crp_etype;
                goto bad;
        }
-       /* Shouldn't happen... */
-       if (m == NULL) {
-               IPCOMP_STATINC(IPCOMP_STAT_CRYPTO);
-               DPRINTF(("%s: null mbuf returned from crypto\n", __func__));
-               error = EINVAL;
-               goto bad;
-       }
+
        IPCOMP_STATINC(IPCOMP_STAT_HIST + ipcomp_stats[sav->alg_comp]);
 
        /* Update the counters */
@@ -563,13 +557,7 @@
                error = crp->crp_etype;
                goto bad;
        }
-       /* Shouldn't happen... */
-       if (m == NULL) {
-               IPCOMP_STATINC(IPCOMP_STAT_CRYPTO);
-               DPRINTF(("%s: bogus return buffer from crypto\n", __func__));
-               error = EINVAL;
-               goto bad;
-       }
+
        IPCOMP_STATINC(IPCOMP_STAT_HIST + ipcomp_stats[sav->alg_comp]);
 
        if (rlen > crp->crp_olen) {



Home | Main Index | Thread Index | Old Index