Source-Changes-HG archive

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

[src/trunk]: src/sys/netipsec Remove duplicate checks, and no need to initial...



details:   https://anonhg.NetBSD.org/src/rev/b9bd591171dd
branches:  trunk
changeset: 359870:b9bd591171dd
user:      maxv <maxv%NetBSD.org@localhost>
date:      Tue Feb 27 14:52:51 2018 +0000

description:
Remove duplicate checks, and no need to initialize 'newsp' in
ipsec_set_policy.

diffstat:

 sys/netipsec/ipsec.c |  13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diffs (46 lines):

diff -r 0182dfb066b8 -r b9bd591171dd sys/netipsec/ipsec.c
--- a/sys/netipsec/ipsec.c      Tue Feb 27 14:45:43 2018 +0000
+++ b/sys/netipsec/ipsec.c      Tue Feb 27 14:52:51 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ipsec.c,v 1.144 2018/02/27 14:44:10 maxv Exp $ */
+/* $NetBSD: ipsec.c,v 1.145 2018/02/27 14:52:51 maxv Exp $ */
 /* $FreeBSD: src/sys/netipsec/ipsec.c,v 1.2.2.2 2003/07/01 01:38:13 sam Exp $ */
 /* $KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $ */
 
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.144 2018/02/27 14:44:10 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.145 2018/02/27 14:52:51 maxv Exp $");
 
 /*
  * IPsec controller part.
@@ -1278,15 +1278,13 @@
     size_t len, kauth_cred_t cred)
 {
        const struct sadb_x_policy *xpl;
-       struct secpolicy *newsp = NULL, *oldsp;
+       struct secpolicy *newsp, *oldsp;
        int error;
 
        KASSERT(!cpu_softintr_p());
 
        /* sanity check. */
-       if (policy == NULL || *policy == NULL || request == NULL)
-               return EINVAL;
-       if (len < sizeof(*xpl))
+       if (policy == NULL || *policy == NULL)
                return EINVAL;
        xpl = (const struct sadb_x_policy *)request;
 
@@ -1396,8 +1394,7 @@
                return EINVAL;
        }
 
-       /* sanity check. */
-       if (policy == NULL || mp == NULL)
+       if (policy == NULL)
                return EINVAL;
 
        *mp = key_sp2msg(policy, M_NOWAIT);



Home | Main Index | Thread Index | Old Index