Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet - this is not python, we need braces



details:   https://anonhg.NetBSD.org/src/rev/a6b554528fc9
branches:  trunk
changeset: 358636:a6b554528fc9
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Jan 10 17:36:06 2018 +0000

description:
- this is not python, we need braces
- protect ifp locking against NULL

diffstat:

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

diffs (48 lines):

diff -r d1ddcb047ba6 -r a6b554528fc9 sys/netinet/ip_output.c
--- a/sys/netinet/ip_output.c   Wed Jan 10 15:58:40 2018 +0000
+++ b/sys/netinet/ip_output.c   Wed Jan 10 17:36:06 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_output.c,v 1.290 2018/01/01 16:14:30 christos Exp $ */
+/*     $NetBSD: ip_output.c,v 1.291 2018/01/10 17:36:06 christos Exp $ */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.290 2018/01/01 16:14:30 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.291 2018/01/10 17:36:06 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1876,13 +1876,14 @@
        bound = curlwp_bind();
        if (sopt->sopt_size == sizeof(struct ip_mreq))
                error = ip_get_membership(sopt, &ifp, &psref, &ia, false);
-       else
+       else {
 #ifdef INET6
                error = ip6_get_membership(sopt, &ifp, &psref, &ia, sizeof(ia));
 #else
                error = EINVAL;
                goto out;
 #endif
+       }
 
        if (error)
                goto out;
@@ -1905,9 +1906,11 @@
         * Give up the multicast address record to which the
         * membership points.
         */
-       IFNET_LOCK(ifp);
+       if (ifp)
+               IFNET_LOCK(ifp);
        in_delmulti(imo->imo_membership[i]);
-       IFNET_UNLOCK(ifp);
+       if (ifp)
+               IFNET_UNLOCK(ifp);
 
        /*
         * Remove the gap in the membership array.



Home | Main Index | Thread Index | Old Index