Source-Changes-HG archive

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

[src/trunk]: src/sys Use M_UNWRITABLE, no functional change.



details:   https://anonhg.NetBSD.org/src/rev/828acfc30753
branches:  trunk
changeset: 322237:828acfc30753
user:      maxv <maxv%NetBSD.org@localhost>
date:      Thu Apr 26 07:28:21 2018 +0000

description:
Use M_UNWRITABLE, no functional change.

diffstat:

 sys/netinet/ip_icmp.c     |   6 +++---
 sys/netinet6/icmp6.c      |   7 +++----
 sys/netinet6/ip6_mroute.c |  14 +++++---------
 3 files changed, 11 insertions(+), 16 deletions(-)

diffs (104 lines):

diff -r fffdd320b404 -r 828acfc30753 sys/netinet/ip_icmp.c
--- a/sys/netinet/ip_icmp.c     Thu Apr 26 07:01:38 2018 +0000
+++ b/sys/netinet/ip_icmp.c     Thu Apr 26 07:28:21 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_icmp.c,v 1.168 2018/02/08 09:32:02 maxv Exp $       */
+/*     $NetBSD: ip_icmp.c,v 1.169 2018/04/26 07:28:21 maxv Exp $       */
 
 /*
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -94,7 +94,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.168 2018/02/08 09:32:02 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.169 2018/04/26 07:28:21 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ipsec.h"
@@ -448,7 +448,7 @@
                goto freeit;
        }
        i = hlen + min(icmplen, ICMP_ADVLENMIN);
-       if ((m->m_len < i || M_READONLY(m)) && (m = m_pullup(m, i)) == NULL) {
+       if (M_UNWRITABLE(m, i) && (m = m_pullup(m, i)) == NULL) {
                ICMP_STATINC(ICMP_STAT_TOOSHORT);
                return;
        }
diff -r fffdd320b404 -r 828acfc30753 sys/netinet6/icmp6.c
--- a/sys/netinet6/icmp6.c      Thu Apr 26 07:01:38 2018 +0000
+++ b/sys/netinet6/icmp6.c      Thu Apr 26 07:28:21 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: icmp6.c,v 1.230 2018/04/14 17:55:47 maxv Exp $ */
+/*     $NetBSD: icmp6.c,v 1.231 2018/04/26 07:28:21 maxv Exp $ */
 /*     $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.230 2018/04/14 17:55:47 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.231 2018/04/26 07:28:21 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -642,8 +642,7 @@
                        /* Give up local */
                        n = m;
                        m = NULL;
-               } else if (M_READONLY(n) ||
-                   n->m_len < off + sizeof(struct icmp6_hdr)) {
+               } else if (M_UNWRITABLE(n, off + sizeof(struct icmp6_hdr))) {
                        struct mbuf *n0 = n;
 
                        /*
diff -r fffdd320b404 -r 828acfc30753 sys/netinet6/ip6_mroute.c
--- a/sys/netinet6/ip6_mroute.c Thu Apr 26 07:01:38 2018 +0000
+++ b/sys/netinet6/ip6_mroute.c Thu Apr 26 07:28:21 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip6_mroute.c,v 1.123 2018/03/21 14:23:54 roy Exp $     */
+/*     $NetBSD: ip6_mroute.c,v 1.124 2018/04/26 07:28:21 maxv Exp $    */
 /*     $KAME: ip6_mroute.c,v 1.49 2001/07/25 09:21:18 jinmei Exp $     */
 
 /*
@@ -117,7 +117,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.123 2018/03/21 14:23:54 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.124 2018/04/26 07:28:21 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1131,8 +1131,7 @@
                 * Pullup packet header if needed before storing it,
                 * as other references may modify it in the meantime.
                 */
-               if (mb0 &&
-                   (M_READONLY(mb0) || mb0->m_len < sizeof(struct ip6_hdr)))
+               if (mb0 && M_UNWRITABLE(mb0, sizeof(struct ip6_hdr)))
                        mb0 = m_pullup(mb0, sizeof(struct ip6_hdr));
                if (mb0 == NULL) {
                        free(rte, M_MRTABLE);
@@ -1416,9 +1415,7 @@
                                struct omrt6msg *oim;
 
                                mm = m_copy(m, 0, sizeof(struct ip6_hdr));
-                               if (mm &&
-                                   (M_READONLY(mm) ||
-                                    mm->m_len < sizeof(struct ip6_hdr)))
+                               if (mm && M_UNWRITABLE(mm, sizeof(struct ip6_hdr)))
                                        mm = m_pullup(mm, sizeof(struct ip6_hdr));
                                if (mm == NULL)
                                        return ENOBUFS;
@@ -1552,8 +1549,7 @@
         * so that ip6_output() only scribbles on the copy.
         */
        mb_copy = m_copy(m, 0, M_COPYALL);
-       if (mb_copy &&
-           (M_READONLY(mb_copy) || mb_copy->m_len < sizeof(struct ip6_hdr)))
+       if (mb_copy && M_UNWRITABLE(mb_copy, sizeof(struct ip6_hdr)))
                mb_copy = m_pullup(mb_copy, sizeof(struct ip6_hdr));
        if (mb_copy == NULL) {
                splx(s);



Home | Main Index | Thread Index | Old Index