[Bug 217509] [patch] netinet/netinet6: missing curly braces in inm_merge/in6m_merge

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Mar 2 23:20:57 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=217509

            Bug ID: 217509
           Summary: [patch] netinet/netinet6: missing curly braces in
                    inm_merge/in6m_merge
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Keywords: patch
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: ngie at FreeBSD.org
          Keywords: patch

Filed via internal bugzilla. This will need to be reviewed by someone in net at .

diff --git a/sys/netinet/in_mcast.c b/sys/netinet/in_mcast.c
index 078f2f24536a..c97e36159d01 100644
--- a/sys/netinet/in_mcast.c
+++ b/sys/netinet/in_mcast.c
@@ -1058,9 +1058,10 @@ inm_merge(struct in_multi *inm, /*const*/ struct
in_mfilter *imf)
        /* Decrement ASM listener count on transition out of ASM mode. */
        if (imf->imf_st[0] == MCAST_EXCLUDE && nsrc0 == 0) {
                if ((imf->imf_st[1] != MCAST_EXCLUDE) ||
-                   (imf->imf_st[1] == MCAST_EXCLUDE && nsrc1 > 0))
+                   (imf->imf_st[1] == MCAST_EXCLUDE && nsrc1 > 0)) {
                        CTR1(KTR_IGMPV3, "%s: --asm on inm at t1", __func__);
                        --inm->inm_st[1].iss_asm;
+               }
        }

        /* Increment ASM listener count on transition to ASM mode. */
diff --git a/sys/netinet6/in6_mcast.c b/sys/netinet6/in6_mcast.c
index 4effb57d0391..b34d02cf35ad 100644
--- a/sys/netinet6/in6_mcast.c
+++ b/sys/netinet6/in6_mcast.c
@@ -999,9 +999,10 @@ in6m_merge(struct in6_multi *inm, /*const*/ struct
in6_mfilter *imf)
        /* Decrement ASM listener count on transition out of ASM mode. */
        if (imf->im6f_st[0] == MCAST_EXCLUDE && nsrc0 == 0) {
                if ((imf->im6f_st[1] != MCAST_EXCLUDE) ||
-                   (imf->im6f_st[1] == MCAST_EXCLUDE && nsrc1 > 0))
+                   (imf->im6f_st[1] == MCAST_EXCLUDE && nsrc1 > 0)) {
                        CTR1(KTR_MLD, "%s: --asm on inm at t1", __func__);
                        --inm->in6m_st[1].iss_asm;
+               }
        }

        /* Increment ASM listener count on transition to ASM mode. */

Add missing braces around MCAST_EXCLUDE check so .iss_asm (the number of ASM
listeners) isn't incorrectly decremented when dealing with MLD-layer source
datagrams when inspecting im*s_st[1] (the second state in the structure).

Reported by: Coverity
Submitted by: Miles Ohlrich <miles.ohlrich at isilon.com>
Sponsored by: Dell EMC Isilon

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list