| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: uipc_mbuf.c,v 1.191 2018/04/17 07:58:31 maxv Exp $ */ | | 1 | /* $NetBSD: uipc_mbuf.c,v 1.192 2018/04/19 05:16:02 maxv Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | | 8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, |
9 | * NASA Ames Research Center. | | 9 | * NASA Ames Research Center. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -52,27 +52,27 @@ | | | @@ -52,27 +52,27 @@ |
52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
59 | * SUCH DAMAGE. | | 59 | * SUCH DAMAGE. |
60 | * | | 60 | * |
61 | * @(#)uipc_mbuf.c 8.4 (Berkeley) 2/14/95 | | 61 | * @(#)uipc_mbuf.c 8.4 (Berkeley) 2/14/95 |
62 | */ | | 62 | */ |
63 | | | 63 | |
64 | #include <sys/cdefs.h> | | 64 | #include <sys/cdefs.h> |
65 | __KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.191 2018/04/17 07:58:31 maxv Exp $"); | | 65 | __KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.192 2018/04/19 05:16:02 maxv Exp $"); |
66 | | | 66 | |
67 | #ifdef _KERNEL_OPT | | 67 | #ifdef _KERNEL_OPT |
68 | #include "opt_mbuftrace.h" | | 68 | #include "opt_mbuftrace.h" |
69 | #include "opt_nmbclusters.h" | | 69 | #include "opt_nmbclusters.h" |
70 | #include "opt_ddb.h" | | 70 | #include "opt_ddb.h" |
71 | #endif | | 71 | #endif |
72 | | | 72 | |
73 | #include <sys/param.h> | | 73 | #include <sys/param.h> |
74 | #include <sys/systm.h> | | 74 | #include <sys/systm.h> |
75 | #include <sys/atomic.h> | | 75 | #include <sys/atomic.h> |
76 | #include <sys/cpu.h> | | 76 | #include <sys/cpu.h> |
77 | #include <sys/proc.h> | | 77 | #include <sys/proc.h> |
78 | #include <sys/mbuf.h> | | 78 | #include <sys/mbuf.h> |
| @@ -1930,27 +1930,27 @@ m_verify_packet(struct mbuf *m) | | | @@ -1930,27 +1930,27 @@ m_verify_packet(struct mbuf *m) |
1930 | dat = n->m_data; | | 1930 | dat = n->m_data; |
1931 | len = n->m_len; | | 1931 | len = n->m_len; |
1932 | | | 1932 | |
1933 | if (n->m_flags & M_EXT) { | | 1933 | if (n->m_flags & M_EXT) { |
1934 | low = n->m_ext.ext_buf; | | 1934 | low = n->m_ext.ext_buf; |
1935 | high = low + n->m_ext.ext_size; | | 1935 | high = low + n->m_ext.ext_size; |
1936 | } else if (n->m_flags & M_PKTHDR) { | | 1936 | } else if (n->m_flags & M_PKTHDR) { |
1937 | low = n->m_pktdat; | | 1937 | low = n->m_pktdat; |
1938 | high = low + MHLEN; | | 1938 | high = low + MHLEN; |
1939 | } else { | | 1939 | } else { |
1940 | low = n->m_dat; | | 1940 | low = n->m_dat; |
1941 | high = low + MLEN; | | 1941 | high = low + MLEN; |
1942 | } | | 1942 | } |
1943 | if (__predict_false(dat + len <= dat)) { | | 1943 | if (__predict_false(dat + len < dat)) { |
1944 | panic("%s: incorrect length (len = %d)", __func__, len); | | 1944 | panic("%s: incorrect length (len = %d)", __func__, len); |
1945 | } | | 1945 | } |
1946 | if (__predict_false((dat < low) || (dat + len > high))) { | | 1946 | if (__predict_false((dat < low) || (dat + len > high))) { |
1947 | panic("%s: m_data not in packet" | | 1947 | panic("%s: m_data not in packet" |
1948 | "(dat = %p, len = %d, low = %p, high = %p)", | | 1948 | "(dat = %p, len = %d, low = %p, high = %p)", |
1949 | __func__, dat, len, low, high); | | 1949 | __func__, dat, len, low, high); |
1950 | } | | 1950 | } |
1951 | | | 1951 | |
1952 | totlen += len; | | 1952 | totlen += len; |
1953 | n = n->m_next; | | 1953 | n = n->m_next; |
1954 | } | | 1954 | } |
1955 | | | 1955 | |
1956 | if (__predict_false(totlen != m->m_pkthdr.len)) { | | 1956 | if (__predict_false(totlen != m->m_pkthdr.len)) { |