Sat Dec 22 14:07:54 2018 UTC ()
Replace: M_COPY_PKTHDR -> m_copy_pkthdr. No functional change, since the
former is a macro to the latter.


(maxv)
diff -r1.32 -r1.33 src/sys/arch/arm/broadcom/bcm53xx_eth.c
diff -r1.34 -r1.35 src/sys/arch/arm/xscale/ixp425_if_npe.c
diff -r1.35 -r1.36 src/sys/dev/ic/bwi.c
diff -r1.35 -r1.36 src/sys/dev/ic/rt2560.c
diff -r1.40 -r1.41 src/sys/dev/ic/rt2661.c
diff -r1.18 -r1.19 src/sys/dev/pci/if_et.c
diff -r1.70 -r1.71 src/sys/dev/pci/if_ipw.c
diff -r1.109 -r1.110 src/sys/dev/pci/if_iwi.c
diff -r1.84 -r1.85 src/sys/dev/pci/if_wpi.c
diff -r1.45 -r1.46 src/sys/dev/pci/ubsec.c
diff -r1.227 -r1.228 src/sys/kern/uipc_mbuf.c
diff -r1.241 -r1.242 src/sys/netinet6/icmp6.c

cvs diff -r1.32 -r1.33 src/sys/arch/arm/broadcom/bcm53xx_eth.c (expand / switch to unified diff)

--- src/sys/arch/arm/broadcom/bcm53xx_eth.c 2018/09/03 16:29:23 1.32
+++ src/sys/arch/arm/broadcom/bcm53xx_eth.c 2018/12/22 14:07:53 1.33
@@ -25,27 +25,27 @@ @@ -25,27 +25,27 @@
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE. 27 * POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30#define _ARM32_BUS_DMA_PRIVATE 30#define _ARM32_BUS_DMA_PRIVATE
31#define GMAC_PRIVATE 31#define GMAC_PRIVATE
32 32
33#include "locators.h" 33#include "locators.h"
34#include "opt_broadcom.h" 34#include "opt_broadcom.h"
35 35
36#include <sys/cdefs.h> 36#include <sys/cdefs.h>
37 37
38__KERNEL_RCSID(1, "$NetBSD: bcm53xx_eth.c,v 1.32 2018/09/03 16:29:23 riastradh Exp $"); 38__KERNEL_RCSID(1, "$NetBSD: bcm53xx_eth.c,v 1.33 2018/12/22 14:07:53 maxv Exp $");
39 39
40#include <sys/param.h> 40#include <sys/param.h>
41#include <sys/atomic.h> 41#include <sys/atomic.h>
42#include <sys/bus.h> 42#include <sys/bus.h>
43#include <sys/device.h> 43#include <sys/device.h>
44#include <sys/ioctl.h> 44#include <sys/ioctl.h>
45#include <sys/intr.h> 45#include <sys/intr.h>
46#include <sys/kmem.h> 46#include <sys/kmem.h>
47#include <sys/mutex.h> 47#include <sys/mutex.h>
48#include <sys/socket.h> 48#include <sys/socket.h>
49#include <sys/systm.h> 49#include <sys/systm.h>
50#include <sys/workqueue.h> 50#include <sys/workqueue.h>
51 51
@@ -1536,27 +1536,27 @@ bcmeth_copy_packet(struct mbuf *m) @@ -1536,27 +1536,27 @@ bcmeth_copy_packet(struct mbuf *m)
1536 m_copydata(n, 0, hlen - m->m_len, &m->m_data[m->m_len]); 1536 m_copydata(n, 0, hlen - m->m_len, &m->m_data[m->m_len]);
1537 m->m_len = hlen; 1537 m->m_len = hlen;
1538 m->m_next = mext; 1538 m->m_next = mext;
1539 while (n != mext) { 1539 while (n != mext) {
1540 n = m_free(n); 1540 n = m_free(n);
1541 } 1541 }
1542 return m; 1542 return m;
1543 } 1543 }
1544 1544
1545 struct mbuf *m0 = m_gethdr(M_DONTWAIT, m->m_type); 1545 struct mbuf *m0 = m_gethdr(M_DONTWAIT, m->m_type);
1546 if (m0 == NULL) { 1546 if (m0 == NULL) {
1547 return NULL; 1547 return NULL;
1548 } 1548 }
1549 M_COPY_PKTHDR(m0, m); 1549 m_copy_pkthdr(m0, m);
1550 MCLAIM(m0, m->m_owner); 1550 MCLAIM(m0, m->m_owner);
1551 if (m0->m_pkthdr.len > MHLEN) { 1551 if (m0->m_pkthdr.len > MHLEN) {
1552 MCLGET(m0, M_DONTWAIT); 1552 MCLGET(m0, M_DONTWAIT);
1553 if ((m0->m_flags & M_EXT) == 0) { 1553 if ((m0->m_flags & M_EXT) == 0) {
1554 m_freem(m0); 1554 m_freem(m0);
1555 return NULL; 1555 return NULL;
1556 } 1556 }
1557 } 1557 }
1558 m0->m_len = m->m_pkthdr.len; 1558 m0->m_len = m->m_pkthdr.len;
1559 m_copydata(m, 0, m0->m_len, mtod(m0, void *)); 1559 m_copydata(m, 0, m0->m_len, mtod(m0, void *));
1560 m_freem(m); 1560 m_freem(m);
1561 return m0; 1561 return m0;
1562} 1562}

cvs diff -r1.34 -r1.35 src/sys/arch/arm/xscale/ixp425_if_npe.c (expand / switch to unified diff)

--- src/sys/arch/arm/xscale/ixp425_if_npe.c 2018/06/26 06:47:58 1.34
+++ src/sys/arch/arm/xscale/ixp425_if_npe.c 2018/12/22 14:07:53 1.35
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ixp425_if_npe.c,v 1.34 2018/06/26 06:47:58 msaitoh Exp $ */ 1/* $NetBSD: ixp425_if_npe.c,v 1.35 2018/12/22 14:07:53 maxv Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2006 Sam Leffler. All rights reserved. 4 * Copyright (c) 2006 Sam Leffler. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -18,27 +18,27 @@ @@ -18,27 +18,27 @@
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27#include <sys/cdefs.h> 27#include <sys/cdefs.h>
28#if 0 28#if 0
29__FBSDID("$FreeBSD: src/sys/arm/xscale/ixp425/if_npe.c,v 1.1 2006/11/19 23:55:23 sam Exp $"); 29__FBSDID("$FreeBSD: src/sys/arm/xscale/ixp425/if_npe.c,v 1.1 2006/11/19 23:55:23 sam Exp $");
30#endif 30#endif
31__KERNEL_RCSID(0, "$NetBSD: ixp425_if_npe.c,v 1.34 2018/06/26 06:47:58 msaitoh Exp $"); 31__KERNEL_RCSID(0, "$NetBSD: ixp425_if_npe.c,v 1.35 2018/12/22 14:07:53 maxv Exp $");
32 32
33/* 33/*
34 * Intel XScale NPE Ethernet driver. 34 * Intel XScale NPE Ethernet driver.
35 * 35 *
36 * This driver handles the two ports present on the IXP425. 36 * This driver handles the two ports present on the IXP425.
37 * Packet processing is done by the Network Processing Engines 37 * Packet processing is done by the Network Processing Engines
38 * (NPE's) that work together with a MAC and PHY. The MAC 38 * (NPE's) that work together with a MAC and PHY. The MAC
39 * is also mapped to the XScale cpu; the PHY is accessed via 39 * is also mapped to the XScale cpu; the PHY is accessed via
40 * the MAC. NPE-XScale communication happens through h/w 40 * the MAC. NPE-XScale communication happens through h/w
41 * queues managed by the Q Manager block. 41 * queues managed by the Q Manager block.
42 * 42 *
43 * The code here replaces the ethAcc, ethMii, and ethDB classes 43 * The code here replaces the ethAcc, ethMii, and ethDB classes
44 * in the Intel Access Library (IAL) and the OS-specific driver. 44 * in the Intel Access Library (IAL) and the OS-specific driver.
@@ -1222,27 +1222,27 @@ npeinit(struct ifnet *ifp) @@ -1222,27 +1222,27 @@ npeinit(struct ifnet *ifp)
1222 * mbufs+clusters. If this is not possible NULL is returned and 1222 * mbufs+clusters. If this is not possible NULL is returned and
1223 * the original mbuf chain is left in its present (potentially 1223 * the original mbuf chain is left in its present (potentially
1224 * modified) state. We use two techniques: collapsing consecutive 1224 * modified) state. We use two techniques: collapsing consecutive
1225 * mbufs and replacing consecutive mbufs by a cluster. 1225 * mbufs and replacing consecutive mbufs by a cluster.
1226 */ 1226 */
1227static __inline struct mbuf * 1227static __inline struct mbuf *
1228npe_defrag(struct mbuf *m0) 1228npe_defrag(struct mbuf *m0)
1229{ 1229{
1230 struct mbuf *m; 1230 struct mbuf *m;
1231 1231
1232 MGETHDR(m, M_DONTWAIT, MT_DATA); 1232 MGETHDR(m, M_DONTWAIT, MT_DATA);
1233 if (m == NULL) 1233 if (m == NULL)
1234 return (NULL); 1234 return (NULL);
1235 M_COPY_PKTHDR(m, m0); 1235 m_copy_pkthdr(m, m0);
1236 1236
1237 if ((m->m_len = m0->m_pkthdr.len) > MHLEN) { 1237 if ((m->m_len = m0->m_pkthdr.len) > MHLEN) {
1238 MCLGET(m, M_DONTWAIT); 1238 MCLGET(m, M_DONTWAIT);
1239 if ((m->m_flags & M_EXT) == 0) { 1239 if ((m->m_flags & M_EXT) == 0) {
1240 m_freem(m); 1240 m_freem(m);
1241 return (NULL); 1241 return (NULL);
1242 } 1242 }
1243 } 1243 }
1244 1244
1245 m_copydata(m0, 0, m0->m_pkthdr.len, mtod(m, void *)); 1245 m_copydata(m0, 0, m0->m_pkthdr.len, mtod(m, void *));
1246 m_freem(m0); 1246 m_freem(m0);
1247 1247
1248 return (m); 1248 return (m);

cvs diff -r1.35 -r1.36 src/sys/dev/ic/bwi.c (expand / switch to unified diff)

--- src/sys/dev/ic/bwi.c 2018/07/25 07:55:44 1.35
+++ src/sys/dev/ic/bwi.c 2018/12/22 14:07:53 1.36
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bwi.c,v 1.35 2018/07/25 07:55:44 msaitoh Exp $ */ 1/* $NetBSD: bwi.c,v 1.36 2018/12/22 14:07:53 maxv Exp $ */
2/* $OpenBSD: bwi.c,v 1.74 2008/02/25 21:13:30 mglocker Exp $ */ 2/* $OpenBSD: bwi.c,v 1.74 2008/02/25 21:13:30 mglocker Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 2007 The DragonFly Project. All rights reserved. 5 * Copyright (c) 2007 The DragonFly Project. All rights reserved.
6 *  6 *
7 * This code is derived from software contributed to The DragonFly Project 7 * This code is derived from software contributed to The DragonFly Project
8 * by Sepherosa Ziehau <sepherosa@gmail.com> 8 * by Sepherosa Ziehau <sepherosa@gmail.com>
9 *  9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 *  13 *
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -38,27 +38,27 @@ @@ -38,27 +38,27 @@
38 */ 38 */
39 39
40/* 40/*
41 * Broadcom AirForce BCM43xx IEEE 802.11b/g wireless network driver 41 * Broadcom AirForce BCM43xx IEEE 802.11b/g wireless network driver
42 * Generic back end 42 * Generic back end
43 */ 43 */
44 44
45/* [TRC: XXX Names beginning with `bwi_ieee80211_*' are those that I 45/* [TRC: XXX Names beginning with `bwi_ieee80211_*' are those that I
46 think should be in NetBSD's generic 802.11 code, not in this 46 think should be in NetBSD's generic 802.11 code, not in this
47 driver.] */ 47 driver.] */
48 48
49 49
50#include <sys/cdefs.h> 50#include <sys/cdefs.h>
51__KERNEL_RCSID(0, "$NetBSD: bwi.c,v 1.35 2018/07/25 07:55:44 msaitoh Exp $"); 51__KERNEL_RCSID(0, "$NetBSD: bwi.c,v 1.36 2018/12/22 14:07:53 maxv Exp $");
52 52
53#include <sys/param.h> 53#include <sys/param.h>
54#include <sys/callout.h> 54#include <sys/callout.h>
55#include <sys/device.h> 55#include <sys/device.h>
56#include <sys/kernel.h> 56#include <sys/kernel.h>
57#include <sys/malloc.h> 57#include <sys/malloc.h>
58#include <sys/mbuf.h> 58#include <sys/mbuf.h>
59#include <sys/socket.h> 59#include <sys/socket.h>
60#include <sys/sockio.h> 60#include <sys/sockio.h>
61#include <sys/sysctl.h> 61#include <sys/sysctl.h>
62#include <sys/systm.h> 62#include <sys/systm.h>
63#include <sys/bus.h> 63#include <sys/bus.h>
64#include <sys/intr.h> 64#include <sys/intr.h>
@@ -9182,27 +9182,27 @@ bwi_encap(struct bwi_softc *sc, int idx, @@ -9182,27 +9182,27 @@ bwi_encap(struct bwi_softc *sc, int idx,
9182 if (error) { /* error == EFBIG */ 9182 if (error) { /* error == EFBIG */
9183 struct mbuf *m_new; 9183 struct mbuf *m_new;
9184 9184
9185 error = 0; 9185 error = 0;
9186 9186
9187 MGETHDR(m_new, M_DONTWAIT, MT_DATA); 9187 MGETHDR(m_new, M_DONTWAIT, MT_DATA);
9188 if (m_new == NULL) { 9188 if (m_new == NULL) {
9189 error = ENOBUFS; 9189 error = ENOBUFS;
9190 aprint_error_dev(sc->sc_dev, 9190 aprint_error_dev(sc->sc_dev,
9191 "can't defrag TX buffer (1)\n"); 9191 "can't defrag TX buffer (1)\n");
9192 goto back; 9192 goto back;
9193 } 9193 }
9194 9194
9195 M_COPY_PKTHDR(m_new, m); 9195 m_copy_pkthdr(m_new, m);
9196 if (m->m_pkthdr.len > MHLEN) { 9196 if (m->m_pkthdr.len > MHLEN) {
9197 MCLGET(m_new, M_DONTWAIT); 9197 MCLGET(m_new, M_DONTWAIT);
9198 if (!(m_new->m_flags & M_EXT)) { 9198 if (!(m_new->m_flags & M_EXT)) {
9199 m_freem(m_new); 9199 m_freem(m_new);
9200 error = ENOBUFS; 9200 error = ENOBUFS;
9201 } 9201 }
9202 } 9202 }
9203  9203
9204 if (error) { 9204 if (error) {
9205 aprint_error_dev(sc->sc_dev, 9205 aprint_error_dev(sc->sc_dev,
9206 "can't defrag TX buffer (2)\n"); 9206 "can't defrag TX buffer (2)\n");
9207 goto back; 9207 goto back;
9208 } 9208 }

cvs diff -r1.35 -r1.36 src/sys/dev/ic/rt2560.c (expand / switch to unified diff)

--- src/sys/dev/ic/rt2560.c 2018/09/03 16:29:31 1.35
+++ src/sys/dev/ic/rt2560.c 2018/12/22 14:07:53 1.36
@@ -1,40 +1,40 @@ @@ -1,40 +1,40 @@
1/* $NetBSD: rt2560.c,v 1.35 2018/09/03 16:29:31 riastradh Exp $ */ 1/* $NetBSD: rt2560.c,v 1.36 2018/12/22 14:07:53 maxv Exp $ */
2/* $OpenBSD: rt2560.c,v 1.15 2006/04/20 20:31:12 miod Exp $ */ 2/* $OpenBSD: rt2560.c,v 1.15 2006/04/20 20:31:12 miod Exp $ */
3/* $FreeBSD: rt2560.c,v 1.3 2006/03/21 21:15:43 damien Exp $*/ 3/* $FreeBSD: rt2560.c,v 1.3 2006/03/21 21:15:43 damien Exp $*/
4 4
5/*- 5/*-
6 * Copyright (c) 2005, 2006 6 * Copyright (c) 2005, 2006
7 * Damien Bergamini <damien.bergamini@free.fr> 7 * Damien Bergamini <damien.bergamini@free.fr>
8 * 8 *
9 * Permission to use, copy, modify, and distribute this software for any 9 * Permission to use, copy, modify, and distribute this software for any
10 * purpose with or without fee is hereby granted, provided that the above 10 * purpose with or without fee is hereby granted, provided that the above
11 * copyright notice and this permission notice appear in all copies. 11 * copyright notice and this permission notice appear in all copies.
12 * 12 *
13 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 13 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 */ 20 */
21 21
22/*- 22/*-
23 * Ralink Technology RT2560 chipset driver 23 * Ralink Technology RT2560 chipset driver
24 * http://www.ralinktech.com/ 24 * http://www.ralinktech.com/
25 */ 25 */
26#include <sys/cdefs.h> 26#include <sys/cdefs.h>
27__KERNEL_RCSID(0, "$NetBSD: rt2560.c,v 1.35 2018/09/03 16:29:31 riastradh Exp $"); 27__KERNEL_RCSID(0, "$NetBSD: rt2560.c,v 1.36 2018/12/22 14:07:53 maxv Exp $");
28 28
29 29
30#include <sys/param.h> 30#include <sys/param.h>
31#include <sys/sockio.h> 31#include <sys/sockio.h>
32#include <sys/mbuf.h> 32#include <sys/mbuf.h>
33#include <sys/kernel.h> 33#include <sys/kernel.h>
34#include <sys/socket.h> 34#include <sys/socket.h>
35#include <sys/systm.h> 35#include <sys/systm.h>
36#include <sys/malloc.h> 36#include <sys/malloc.h>
37#include <sys/callout.h> 37#include <sys/callout.h>
38#include <sys/conf.h> 38#include <sys/conf.h>
39#include <sys/device.h> 39#include <sys/device.h>
40 40
@@ -2006,27 +2006,27 @@ rt2560_tx_data(struct rt2560_softc *sc,  @@ -2006,27 +2006,27 @@ rt2560_tx_data(struct rt2560_softc *sc,
2006 error); 2006 error);
2007 m_freem(m0); 2007 m_freem(m0);
2008 return error; 2008 return error;
2009 } 2009 }
2010 if (error != 0) { 2010 if (error != 0) {
2011 /* too many fragments, linearize */ 2011 /* too many fragments, linearize */
2012 2012
2013 MGETHDR(mnew, M_DONTWAIT, MT_DATA); 2013 MGETHDR(mnew, M_DONTWAIT, MT_DATA);
2014 if (mnew == NULL) { 2014 if (mnew == NULL) {
2015 m_freem(m0); 2015 m_freem(m0);
2016 return ENOMEM; 2016 return ENOMEM;
2017 } 2017 }
2018 2018
2019 M_COPY_PKTHDR(mnew, m0); 2019 m_copy_pkthdr(mnew, m0);
2020 if (m0->m_pkthdr.len > MHLEN) { 2020 if (m0->m_pkthdr.len > MHLEN) {
2021 MCLGET(mnew, M_DONTWAIT); 2021 MCLGET(mnew, M_DONTWAIT);
2022 if (!(mnew->m_flags & M_EXT)) { 2022 if (!(mnew->m_flags & M_EXT)) {
2023 m_freem(m0); 2023 m_freem(m0);
2024 m_freem(mnew); 2024 m_freem(mnew);
2025 return ENOMEM; 2025 return ENOMEM;
2026 } 2026 }
2027 } 2027 }
2028 2028
2029 m_copydata(m0, 0, m0->m_pkthdr.len, mtod(mnew, void *)); 2029 m_copydata(m0, 0, m0->m_pkthdr.len, mtod(mnew, void *));
2030 m_freem(m0); 2030 m_freem(m0);
2031 mnew->m_len = mnew->m_pkthdr.len; 2031 mnew->m_len = mnew->m_pkthdr.len;
2032 m0 = mnew; 2032 m0 = mnew;

cvs diff -r1.40 -r1.41 src/sys/dev/ic/rt2661.c (expand / switch to unified diff)

--- src/sys/dev/ic/rt2661.c 2018/09/03 16:29:31 1.40
+++ src/sys/dev/ic/rt2661.c 2018/12/22 14:07:53 1.41
@@ -1,41 +1,41 @@ @@ -1,41 +1,41 @@
1/* $NetBSD: rt2661.c,v 1.40 2018/09/03 16:29:31 riastradh Exp $ */ 1/* $NetBSD: rt2661.c,v 1.41 2018/12/22 14:07:53 maxv Exp $ */
2/* $OpenBSD: rt2661.c,v 1.17 2006/05/01 08:41:11 damien Exp $ */ 2/* $OpenBSD: rt2661.c,v 1.17 2006/05/01 08:41:11 damien Exp $ */
3/* $FreeBSD: rt2560.c,v 1.5 2006/06/02 19:59:31 csjp Exp $ */ 3/* $FreeBSD: rt2560.c,v 1.5 2006/06/02 19:59:31 csjp Exp $ */
4 4
5/*- 5/*-
6 * Copyright (c) 2006 6 * Copyright (c) 2006
7 * Damien Bergamini <damien.bergamini@free.fr> 7 * Damien Bergamini <damien.bergamini@free.fr>
8 * 8 *
9 * Permission to use, copy, modify, and distribute this software for any 9 * Permission to use, copy, modify, and distribute this software for any
10 * purpose with or without fee is hereby granted, provided that the above 10 * purpose with or without fee is hereby granted, provided that the above
11 * copyright notice and this permission notice appear in all copies. 11 * copyright notice and this permission notice appear in all copies.
12 * 12 *
13 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 13 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 */ 20 */
21 21
22/*- 22/*-
23 * Ralink Technology RT2561, RT2561S and RT2661 chipset driver 23 * Ralink Technology RT2561, RT2561S and RT2661 chipset driver
24 * http://www.ralinktech.com/ 24 * http://www.ralinktech.com/
25 */ 25 */
26 26
27#include <sys/cdefs.h> 27#include <sys/cdefs.h>
28__KERNEL_RCSID(0, "$NetBSD: rt2661.c,v 1.40 2018/09/03 16:29:31 riastradh Exp $"); 28__KERNEL_RCSID(0, "$NetBSD: rt2661.c,v 1.41 2018/12/22 14:07:53 maxv Exp $");
29 29
30 30
31#include <sys/param.h> 31#include <sys/param.h>
32#include <sys/sockio.h> 32#include <sys/sockio.h>
33#include <sys/sysctl.h> 33#include <sys/sysctl.h>
34#include <sys/mbuf.h> 34#include <sys/mbuf.h>
35#include <sys/kernel.h> 35#include <sys/kernel.h>
36#include <sys/socket.h> 36#include <sys/socket.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38#include <sys/malloc.h> 38#include <sys/malloc.h>
39#include <sys/callout.h> 39#include <sys/callout.h>
40#include <sys/conf.h> 40#include <sys/conf.h>
41#include <sys/device.h> 41#include <sys/device.h>
@@ -1743,27 +1743,27 @@ rt2661_tx_data(struct rt2661_softc *sc,  @@ -1743,27 +1743,27 @@ rt2661_tx_data(struct rt2661_softc *sc,
1743 error); 1743 error);
1744 m_freem(m0); 1744 m_freem(m0);
1745 return error; 1745 return error;
1746 } 1746 }
1747 if (error != 0) { 1747 if (error != 0) {
1748 /* too many fragments, linearize */ 1748 /* too many fragments, linearize */
1749 1749
1750 MGETHDR(mnew, M_DONTWAIT, MT_DATA); 1750 MGETHDR(mnew, M_DONTWAIT, MT_DATA);
1751 if (mnew == NULL) { 1751 if (mnew == NULL) {
1752 m_freem(m0); 1752 m_freem(m0);
1753 return ENOMEM; 1753 return ENOMEM;
1754 } 1754 }
1755 1755
1756 M_COPY_PKTHDR(mnew, m0); 1756 m_copy_pkthdr(mnew, m0);
1757 if (m0->m_pkthdr.len > MHLEN) { 1757 if (m0->m_pkthdr.len > MHLEN) {
1758 MCLGET(mnew, M_DONTWAIT); 1758 MCLGET(mnew, M_DONTWAIT);
1759 if (!(mnew->m_flags & M_EXT)) { 1759 if (!(mnew->m_flags & M_EXT)) {
1760 m_freem(m0); 1760 m_freem(m0);
1761 m_freem(mnew); 1761 m_freem(mnew);
1762 return ENOMEM; 1762 return ENOMEM;
1763 } 1763 }
1764 } 1764 }
1765 1765
1766 m_copydata(m0, 0, m0->m_pkthdr.len, mtod(mnew, void *)); 1766 m_copydata(m0, 0, m0->m_pkthdr.len, mtod(mnew, void *));
1767 m_freem(m0); 1767 m_freem(m0);
1768 mnew->m_len = mnew->m_pkthdr.len; 1768 mnew->m_len = mnew->m_pkthdr.len;
1769 m0 = mnew; 1769 m0 = mnew;

cvs diff -r1.18 -r1.19 src/sys/dev/pci/if_et.c (expand / switch to unified diff)

--- src/sys/dev/pci/if_et.c 2018/12/09 11:14:02 1.18
+++ src/sys/dev/pci/if_et.c 2018/12/22 14:07:53 1.19
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_et.c,v 1.18 2018/12/09 11:14:02 jdolecek Exp $ */ 1/* $NetBSD: if_et.c,v 1.19 2018/12/22 14:07:53 maxv Exp $ */
2/* $OpenBSD: if_et.c,v 1.11 2008/06/08 06:18:07 jsg Exp $ */ 2/* $OpenBSD: if_et.c,v 1.11 2008/06/08 06:18:07 jsg Exp $ */
3/* 3/*
4 * Copyright (c) 2007 The DragonFly Project. All rights reserved. 4 * Copyright (c) 2007 The DragonFly Project. All rights reserved.
5 * 5 *
6 * This code is derived from software contributed to The DragonFly Project 6 * This code is derived from software contributed to The DragonFly Project
7 * by Sepherosa Ziehau <sepherosa@gmail.com> 7 * by Sepherosa Ziehau <sepherosa@gmail.com>
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 12 *
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -27,27 +27,27 @@ @@ -27,27 +27,27 @@
27 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, 28 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
29 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 30 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
31 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 31 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
33 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE. 34 * SUCH DAMAGE.
35 * 35 *
36 * $DragonFly: src/sys/dev/netif/et/if_et.c,v 1.1 2007/10/12 14:12:42 sephe Exp $ 36 * $DragonFly: src/sys/dev/netif/et/if_et.c,v 1.1 2007/10/12 14:12:42 sephe Exp $
37 */ 37 */
38 38
39#include <sys/cdefs.h> 39#include <sys/cdefs.h>
40__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.18 2018/12/09 11:14:02 jdolecek Exp $"); 40__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.19 2018/12/22 14:07:53 maxv Exp $");
41 41
42#include "opt_inet.h" 42#include "opt_inet.h"
43#include "vlan.h" 43#include "vlan.h"
44 44
45#include <sys/param.h> 45#include <sys/param.h>
46#include <sys/endian.h> 46#include <sys/endian.h>
47#include <sys/systm.h> 47#include <sys/systm.h>
48#include <sys/types.h> 48#include <sys/types.h>
49#include <sys/sockio.h> 49#include <sys/sockio.h>
50#include <sys/mbuf.h> 50#include <sys/mbuf.h>
51#include <sys/queue.h> 51#include <sys/queue.h>
52#include <sys/kernel.h> 52#include <sys/kernel.h>
53#include <sys/device.h> 53#include <sys/device.h>
@@ -1816,27 +1816,27 @@ et_encap(struct et_softc *sc, struct mbu @@ -1816,27 +1816,27 @@ et_encap(struct et_softc *sc, struct mbu
1816 } 1816 }
1817 if (error) { /* error == EFBIG */ 1817 if (error) { /* error == EFBIG */
1818 struct mbuf *m_new; 1818 struct mbuf *m_new;
1819 1819
1820 error = 0; 1820 error = 0;
1821 1821
1822 MGETHDR(m_new, M_DONTWAIT, MT_DATA); 1822 MGETHDR(m_new, M_DONTWAIT, MT_DATA);
1823 if (m_new == NULL) { 1823 if (m_new == NULL) {
1824 aprint_error_dev(sc->sc_dev, "can't defrag TX mbuf\n"); 1824 aprint_error_dev(sc->sc_dev, "can't defrag TX mbuf\n");
1825 error = ENOBUFS; 1825 error = ENOBUFS;
1826 goto back; 1826 goto back;
1827 } 1827 }
1828 1828
1829 M_COPY_PKTHDR(m_new, m); 1829 m_copy_pkthdr(m_new, m);
1830 if (m->m_pkthdr.len > MHLEN) { 1830 if (m->m_pkthdr.len > MHLEN) {
1831 MCLGET(m_new, M_DONTWAIT); 1831 MCLGET(m_new, M_DONTWAIT);
1832 if (!(m_new->m_flags & M_EXT)) { 1832 if (!(m_new->m_flags & M_EXT)) {
1833 m_freem(m_new); 1833 m_freem(m_new);
1834 error = ENOBUFS; 1834 error = ENOBUFS;
1835 } 1835 }
1836 } 1836 }
1837 1837
1838 if (error) { 1838 if (error) {
1839 aprint_error_dev(sc->sc_dev, "can't defrag TX buffer\n"); 1839 aprint_error_dev(sc->sc_dev, "can't defrag TX buffer\n");
1840 goto back; 1840 goto back;
1841 } 1841 }
1842 1842

cvs diff -r1.70 -r1.71 src/sys/dev/pci/if_ipw.c (expand / switch to unified diff)

--- src/sys/dev/pci/if_ipw.c 2018/12/09 11:14:02 1.70
+++ src/sys/dev/pci/if_ipw.c 2018/12/22 14:07:53 1.71
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_ipw.c,v 1.70 2018/12/09 11:14:02 jdolecek Exp $ */ 1/* $NetBSD: if_ipw.c,v 1.71 2018/12/22 14:07:53 maxv Exp $ */
2/* FreeBSD: src/sys/dev/ipw/if_ipw.c,v 1.15 2005/11/13 17:17:40 damien Exp */ 2/* FreeBSD: src/sys/dev/ipw/if_ipw.c,v 1.15 2005/11/13 17:17:40 damien Exp */
3 3
4/*- 4/*-
5 * Copyright (c) 2004, 2005 5 * Copyright (c) 2004, 2005
6 * Damien Bergamini <damien.bergamini@free.fr>. All rights reserved. 6 * Damien Bergamini <damien.bergamini@free.fr>. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice unmodified, this list of conditions, and the following 12 * notice unmodified, this list of conditions, and the following
13 * disclaimer. 13 * disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -19,27 +19,27 @@ @@ -19,27 +19,27 @@
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE. 28 * SUCH DAMAGE.
29 */ 29 */
30 30
31#include <sys/cdefs.h> 31#include <sys/cdefs.h>
32__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.70 2018/12/09 11:14:02 jdolecek Exp $"); 32__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.71 2018/12/22 14:07:53 maxv Exp $");
33 33
34/*- 34/*-
35 * Intel(R) PRO/Wireless 2100 MiniPCI driver 35 * Intel(R) PRO/Wireless 2100 MiniPCI driver
36 * http://www.intel.com/network/connectivity/products/wireless/prowireless_mobile.htm 36 * http://www.intel.com/network/connectivity/products/wireless/prowireless_mobile.htm
37 */ 37 */
38 38
39 39
40#include <sys/param.h> 40#include <sys/param.h>
41#include <sys/sockio.h> 41#include <sys/sockio.h>
42#include <sys/sysctl.h> 42#include <sys/sysctl.h>
43#include <sys/mbuf.h> 43#include <sys/mbuf.h>
44#include <sys/kernel.h> 44#include <sys/kernel.h>
45#include <sys/socket.h> 45#include <sys/socket.h>
@@ -1410,27 +1410,27 @@ ipw_tx_start(struct ifnet *ifp, struct m @@ -1410,27 +1410,27 @@ ipw_tx_start(struct ifnet *ifp, struct m
1410 m_freem(m0); 1410 m_freem(m0);
1411 return error; 1411 return error;
1412 } 1412 }
1413 1413
1414 if (error != 0) { 1414 if (error != 0) {
1415 /* too many fragments, linearize */ 1415 /* too many fragments, linearize */
1416 1416
1417 MGETHDR(mnew, M_DONTWAIT, MT_DATA); 1417 MGETHDR(mnew, M_DONTWAIT, MT_DATA);
1418 if (mnew == NULL) { 1418 if (mnew == NULL) {
1419 m_freem(m0); 1419 m_freem(m0);
1420 return ENOMEM; 1420 return ENOMEM;
1421 } 1421 }
1422 1422
1423 M_COPY_PKTHDR(mnew, m0); 1423 m_copy_pkthdr(mnew, m0);
1424 1424
1425 /* If the data won't fit in the header, get a cluster */ 1425 /* If the data won't fit in the header, get a cluster */
1426 if (m0->m_pkthdr.len > MHLEN) { 1426 if (m0->m_pkthdr.len > MHLEN) {
1427 MCLGET(mnew, M_DONTWAIT); 1427 MCLGET(mnew, M_DONTWAIT);
1428 if (!(mnew->m_flags & M_EXT)) { 1428 if (!(mnew->m_flags & M_EXT)) {
1429 m_freem(m0); 1429 m_freem(m0);
1430 m_freem(mnew); 1430 m_freem(mnew);
1431 return ENOMEM; 1431 return ENOMEM;
1432 } 1432 }
1433 } 1433 }
1434 m_copydata(m0, 0, m0->m_pkthdr.len, mtod(mnew, void *)); 1434 m_copydata(m0, 0, m0->m_pkthdr.len, mtod(mnew, void *));
1435 m_freem(m0); 1435 m_freem(m0);
1436 mnew->m_len = mnew->m_pkthdr.len; 1436 mnew->m_len = mnew->m_pkthdr.len;

cvs diff -r1.109 -r1.110 src/sys/dev/pci/if_iwi.c (expand / switch to unified diff)

--- src/sys/dev/pci/if_iwi.c 2018/12/09 11:14:02 1.109
+++ src/sys/dev/pci/if_iwi.c 2018/12/22 14:07:53 1.110
@@ -1,35 +1,35 @@ @@ -1,35 +1,35 @@
1/* $NetBSD: if_iwi.c,v 1.109 2018/12/09 11:14:02 jdolecek Exp $ */ 1/* $NetBSD: if_iwi.c,v 1.110 2018/12/22 14:07:53 maxv Exp $ */
2/* $OpenBSD: if_iwi.c,v 1.111 2010/11/15 19:11:57 damien Exp $ */ 2/* $OpenBSD: if_iwi.c,v 1.111 2010/11/15 19:11:57 damien Exp $ */
3 3
4/*- 4/*-
5 * Copyright (c) 2004-2008 5 * Copyright (c) 2004-2008
6 * Damien Bergamini <damien.bergamini@free.fr>. All rights reserved. 6 * Damien Bergamini <damien.bergamini@free.fr>. All rights reserved.
7 * 7 *
8 * Permission to use, copy, modify, and distribute this software for any 8 * Permission to use, copy, modify, and distribute this software for any
9 * purpose with or without fee is hereby granted, provided that the above 9 * purpose with or without fee is hereby granted, provided that the above
10 * copyright notice and this permission notice appear in all copies. 10 * copyright notice and this permission notice appear in all copies.
11 * 11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 */ 19 */
20 20
21#include <sys/cdefs.h> 21#include <sys/cdefs.h>
22__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.109 2018/12/09 11:14:02 jdolecek Exp $"); 22__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.110 2018/12/22 14:07:53 maxv Exp $");
23 23
24/*- 24/*-
25 * Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver 25 * Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver
26 * http://www.intel.com/network/connectivity/products/wireless/prowireless_mobile.htm 26 * http://www.intel.com/network/connectivity/products/wireless/prowireless_mobile.htm
27 */ 27 */
28 28
29 29
30#include <sys/param.h> 30#include <sys/param.h>
31#include <sys/sockio.h> 31#include <sys/sockio.h>
32#include <sys/sysctl.h> 32#include <sys/sysctl.h>
33#include <sys/mbuf.h> 33#include <sys/mbuf.h>
34#include <sys/kernel.h> 34#include <sys/kernel.h>
35#include <sys/socket.h> 35#include <sys/socket.h>
@@ -1681,27 +1681,27 @@ iwi_tx_start(struct ifnet *ifp, struct m @@ -1681,27 +1681,27 @@ iwi_tx_start(struct ifnet *ifp, struct m
1681 error); 1681 error);
1682 m_freem(m0); 1682 m_freem(m0);
1683 return error; 1683 return error;
1684 } 1684 }
1685 if (error != 0) { 1685 if (error != 0) {
1686 /* too many fragments, linearize */ 1686 /* too many fragments, linearize */
1687 1687
1688 MGETHDR(mnew, M_DONTWAIT, MT_DATA); 1688 MGETHDR(mnew, M_DONTWAIT, MT_DATA);
1689 if (mnew == NULL) { 1689 if (mnew == NULL) {
1690 m_freem(m0); 1690 m_freem(m0);
1691 return ENOMEM; 1691 return ENOMEM;
1692 } 1692 }
1693 1693
1694 M_COPY_PKTHDR(mnew, m0); 1694 m_copy_pkthdr(mnew, m0);
1695 1695
1696 /* If the data won't fit in the header, get a cluster */ 1696 /* If the data won't fit in the header, get a cluster */
1697 if (m0->m_pkthdr.len > MHLEN) { 1697 if (m0->m_pkthdr.len > MHLEN) {
1698 MCLGET(mnew, M_DONTWAIT); 1698 MCLGET(mnew, M_DONTWAIT);
1699 if (!(mnew->m_flags & M_EXT)) { 1699 if (!(mnew->m_flags & M_EXT)) {
1700 m_freem(m0); 1700 m_freem(m0);
1701 m_freem(mnew); 1701 m_freem(mnew);
1702 return ENOMEM; 1702 return ENOMEM;
1703 } 1703 }
1704 } 1704 }
1705 m_copydata(m0, 0, m0->m_pkthdr.len, mtod(mnew, void *)); 1705 m_copydata(m0, 0, m0->m_pkthdr.len, mtod(mnew, void *));
1706 m_freem(m0); 1706 m_freem(m0);
1707 mnew->m_len = mnew->m_pkthdr.len; 1707 mnew->m_len = mnew->m_pkthdr.len;

cvs diff -r1.84 -r1.85 src/sys/dev/pci/if_wpi.c (expand / switch to unified diff)

--- src/sys/dev/pci/if_wpi.c 2018/12/09 11:14:02 1.84
+++ src/sys/dev/pci/if_wpi.c 2018/12/22 14:07:53 1.85
@@ -1,34 +1,34 @@ @@ -1,34 +1,34 @@
1/* $NetBSD: if_wpi.c,v 1.84 2018/12/09 11:14:02 jdolecek Exp $ */ 1/* $NetBSD: if_wpi.c,v 1.85 2018/12/22 14:07:53 maxv Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2006, 2007 4 * Copyright (c) 2006, 2007
5 * Damien Bergamini <damien.bergamini@free.fr> 5 * Damien Bergamini <damien.bergamini@free.fr>
6 * 6 *
7 * Permission to use, copy, modify, and distribute this software for any 7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above 8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies. 9 * copyright notice and this permission notice appear in all copies.
10 * 10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */ 18 */
19 19
20#include <sys/cdefs.h> 20#include <sys/cdefs.h>
21__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.84 2018/12/09 11:14:02 jdolecek Exp $"); 21__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.85 2018/12/22 14:07:53 maxv Exp $");
22 22
23/* 23/*
24 * Driver for Intel PRO/Wireless 3945ABG 802.11 network adapters. 24 * Driver for Intel PRO/Wireless 3945ABG 802.11 network adapters.
25 */ 25 */
26 26
27 27
28#include <sys/param.h> 28#include <sys/param.h>
29#include <sys/sockio.h> 29#include <sys/sockio.h>
30#include <sys/sysctl.h> 30#include <sys/sysctl.h>
31#include <sys/mbuf.h> 31#include <sys/mbuf.h>
32#include <sys/kernel.h> 32#include <sys/kernel.h>
33#include <sys/socket.h> 33#include <sys/socket.h>
34#include <sys/systm.h> 34#include <sys/systm.h>
@@ -2027,27 +2027,27 @@ wpi_tx_data(struct wpi_softc *sc, struct @@ -2027,27 +2027,27 @@ wpi_tx_data(struct wpi_softc *sc, struct
2027 aprint_error_dev(sc->sc_dev, "could not map mbuf (error %d)\n", 2027 aprint_error_dev(sc->sc_dev, "could not map mbuf (error %d)\n",
2028 error); 2028 error);
2029 m_freem(m0); 2029 m_freem(m0);
2030 return error; 2030 return error;
2031 } 2031 }
2032 if (error != 0) { 2032 if (error != 0) {
2033 /* too many fragments, linearize */ 2033 /* too many fragments, linearize */
2034 2034
2035 MGETHDR(mnew, M_DONTWAIT, MT_DATA); 2035 MGETHDR(mnew, M_DONTWAIT, MT_DATA);
2036 if (mnew == NULL) { 2036 if (mnew == NULL) {
2037 m_freem(m0); 2037 m_freem(m0);
2038 return ENOMEM; 2038 return ENOMEM;
2039 } 2039 }
2040 M_COPY_PKTHDR(mnew, m0); 2040 m_copy_pkthdr(mnew, m0);
2041 if (m0->m_pkthdr.len > MHLEN) { 2041 if (m0->m_pkthdr.len > MHLEN) {
2042 MCLGET(mnew, M_DONTWAIT); 2042 MCLGET(mnew, M_DONTWAIT);
2043 if (!(mnew->m_flags & M_EXT)) { 2043 if (!(mnew->m_flags & M_EXT)) {
2044 m_freem(m0); 2044 m_freem(m0);
2045 m_freem(mnew); 2045 m_freem(mnew);
2046 return ENOMEM; 2046 return ENOMEM;
2047 } 2047 }
2048 } 2048 }
2049 2049
2050 m_copydata(m0, 0, m0->m_pkthdr.len, mtod(mnew, void *)); 2050 m_copydata(m0, 0, m0->m_pkthdr.len, mtod(mnew, void *));
2051 m_freem(m0); 2051 m_freem(m0);
2052 mnew->m_len = mnew->m_pkthdr.len; 2052 mnew->m_len = mnew->m_pkthdr.len;
2053 m0 = mnew; 2053 m0 = mnew;

cvs diff -r1.45 -r1.46 src/sys/dev/pci/ubsec.c (expand / switch to unified diff)

--- src/sys/dev/pci/ubsec.c 2018/12/09 11:14:02 1.45
+++ src/sys/dev/pci/ubsec.c 2018/12/22 14:07:53 1.46
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ubsec.c,v 1.45 2018/12/09 11:14:02 jdolecek Exp $ */ 1/* $NetBSD: ubsec.c,v 1.46 2018/12/22 14:07:53 maxv Exp $ */
2/* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ */ 2/* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ */
3/* $OpenBSD: ubsec.c,v 1.143 2009/03/27 13:31:30 reyk Exp$ */ 3/* $OpenBSD: ubsec.c,v 1.143 2009/03/27 13:31:30 reyk Exp$ */
4 4
5/* 5/*
6 * Copyright (c) 2000 Jason L. Wright (jason@thought.net) 6 * Copyright (c) 2000 Jason L. Wright (jason@thought.net)
7 * Copyright (c) 2000 Theo de Raadt (deraadt@openbsd.org) 7 * Copyright (c) 2000 Theo de Raadt (deraadt@openbsd.org)
8 * Copyright (c) 2001 Patrik Lindergren (patrik@ipunplugged.com) 8 * Copyright (c) 2001 Patrik Lindergren (patrik@ipunplugged.com)
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -25,27 +25,27 @@ @@ -25,27 +25,27 @@
25 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 27 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 * 30 *
31 * Effort sponsored in part by the Defense Advanced Research Projects 31 * Effort sponsored in part by the Defense Advanced Research Projects
32 * Agency (DARPA) and Air Force Research Laboratory, Air Force 32 * Agency (DARPA) and Air Force Research Laboratory, Air Force
33 * Materiel Command, USAF, under agreement number F30602-01-2-0537. 33 * Materiel Command, USAF, under agreement number F30602-01-2-0537.
34 * 34 *
35 */ 35 */
36 36
37#include <sys/cdefs.h> 37#include <sys/cdefs.h>
38__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.45 2018/12/09 11:14:02 jdolecek Exp $"); 38__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.46 2018/12/22 14:07:53 maxv Exp $");
39 39
40#undef UBSEC_DEBUG 40#undef UBSEC_DEBUG
41 41
42/* 42/*
43 * uBsec 5[56]01, 58xx hardware crypto accelerator 43 * uBsec 5[56]01, 58xx hardware crypto accelerator
44 */ 44 */
45 45
46#include <sys/param.h> 46#include <sys/param.h>
47#include <sys/systm.h> 47#include <sys/systm.h>
48#include <sys/proc.h> 48#include <sys/proc.h>
49#include <sys/endian.h> 49#include <sys/endian.h>
50#ifdef __NetBSD__ 50#ifdef __NetBSD__
51 #define UBSEC_NO_RNG /* hangs on attach */ 51 #define UBSEC_NO_RNG /* hangs on attach */
@@ -1579,27 +1579,27 @@ ubsec_process(void *arg, struct cryptop  @@ -1579,27 +1579,27 @@ ubsec_process(void *arg, struct cryptop
1579 m = NULL; 1579 m = NULL;
1580 } 1580 }
1581 } else { 1581 } else {
1582 len = MLEN; 1582 len = MLEN;
1583 MGET(m, M_DONTWAIT, MT_DATA); 1583 MGET(m, M_DONTWAIT, MT_DATA);
1584 } 1584 }
1585 if (m == NULL) { 1585 if (m == NULL) {
1586 ubsecstats.hst_nombuf++; 1586 ubsecstats.hst_nombuf++;
1587 err = sc->sc_nqueue ? ERESTART : ENOMEM; 1587 err = sc->sc_nqueue ? ERESTART : ENOMEM;
1588 goto errout; 1588 goto errout;
1589 } 1589 }
1590 if (len == MHLEN) 1590 if (len == MHLEN)
1591 /*XXX was M_DUP_PKTHDR*/ 1591 /*XXX was M_DUP_PKTHDR*/
1592 M_COPY_PKTHDR(m, q->q_src_m); 1592 m_copy_pkthdr(m, q->q_src_m);
1593 if (totlen >= MINCLSIZE) { 1593 if (totlen >= MINCLSIZE) {
1594 MCLGET(m, M_DONTWAIT); 1594 MCLGET(m, M_DONTWAIT);
1595 if ((m->m_flags & M_EXT) == 0) { 1595 if ((m->m_flags & M_EXT) == 0) {
1596 m_free(m); 1596 m_free(m);
1597 ubsecstats.hst_nomcl++; 1597 ubsecstats.hst_nomcl++;
1598 err = sc->sc_nqueue 1598 err = sc->sc_nqueue
1599 ? ERESTART : ENOMEM; 1599 ? ERESTART : ENOMEM;
1600 goto errout; 1600 goto errout;
1601 } 1601 }
1602 len = MCLBYTES; 1602 len = MCLBYTES;
1603 } 1603 }
1604 m->m_len = len; 1604 m->m_len = len;
1605 top = NULL; 1605 top = NULL;

cvs diff -r1.227 -r1.228 src/sys/kern/uipc_mbuf.c (expand / switch to unified diff)

--- src/sys/kern/uipc_mbuf.c 2018/12/22 13:55:56 1.227
+++ src/sys/kern/uipc_mbuf.c 2018/12/22 14:07:53 1.228
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: uipc_mbuf.c,v 1.227 2018/12/22 13:55:56 maxv Exp $ */ 1/* $NetBSD: uipc_mbuf.c,v 1.228 2018/12/22 14:07:53 maxv Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1999, 2001, 2018 The NetBSD Foundation, Inc. 4 * Copyright (c) 1999, 2001, 2018 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, and Maxime Villard. 9 * NASA Ames Research Center, and Maxime Villard.
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.227 2018/12/22 13:55:56 maxv Exp $"); 65__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.228 2018/12/22 14:07:53 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#include "ether.h" 71#include "ether.h"
72#endif 72#endif
73 73
74#include <sys/param.h> 74#include <sys/param.h>
75#include <sys/systm.h> 75#include <sys/systm.h>
76#include <sys/atomic.h> 76#include <sys/atomic.h>
77#include <sys/cpu.h> 77#include <sys/cpu.h>
78#include <sys/proc.h> 78#include <sys/proc.h>
@@ -704,27 +704,27 @@ m_copy_internal(struct mbuf *m, int off0 @@ -704,27 +704,27 @@ m_copy_internal(struct mbuf *m, int off0
704 if (len != M_COPYALL) 704 if (len != M_COPYALL)
705 panic("%s: m == NULL, len %d [!COPYALL]", 705 panic("%s: m == NULL, len %d [!COPYALL]",
706 __func__, len); 706 __func__, len);
707 break; 707 break;
708 } 708 }
709 709
710 n = m_get(wait, m->m_type); 710 n = m_get(wait, m->m_type);
711 *np = n; 711 *np = n;
712 if (n == NULL) 712 if (n == NULL)
713 goto nospace; 713 goto nospace;
714 MCLAIM(n, m->m_owner); 714 MCLAIM(n, m->m_owner);
715 715
716 if (copyhdr) { 716 if (copyhdr) {
717 M_COPY_PKTHDR(n, m); 717 m_copy_pkthdr(n, m);
718 if (len == M_COPYALL) 718 if (len == M_COPYALL)
719 n->m_pkthdr.len -= off0; 719 n->m_pkthdr.len -= off0;
720 else 720 else
721 n->m_pkthdr.len = len; 721 n->m_pkthdr.len = len;
722 copyhdr = 0; 722 copyhdr = 0;
723 } 723 }
724 n->m_len = m_copylen(len, m->m_len - off); 724 n->m_len = m_copylen(len, m->m_len - off);
725 725
726 if (m->m_flags & M_EXT) { 726 if (m->m_flags & M_EXT) {
727 if (!deep) { 727 if (!deep) {
728 n->m_data = m->m_data + off; 728 n->m_data = m->m_data + off;
729 MCLADDREFERENCE(m, n); 729 MCLADDREFERENCE(m, n);
730 } else { 730 } else {
@@ -774,27 +774,27 @@ m_copypacket(struct mbuf *m, int how) @@ -774,27 +774,27 @@ m_copypacket(struct mbuf *m, int how)
774{ 774{
775 struct mbuf *top, *n, *o; 775 struct mbuf *top, *n, *o;
776 776
777 if (__predict_false((m->m_flags & M_PKTHDR) == 0)) { 777 if (__predict_false((m->m_flags & M_PKTHDR) == 0)) {
778 panic("%s: no header (m = %p)", __func__, m); 778 panic("%s: no header (m = %p)", __func__, m);
779 } 779 }
780 780
781 n = m_get(how, m->m_type); 781 n = m_get(how, m->m_type);
782 top = n; 782 top = n;
783 if (!n) 783 if (!n)
784 goto nospace; 784 goto nospace;
785 785
786 MCLAIM(n, m->m_owner); 786 MCLAIM(n, m->m_owner);
787 M_COPY_PKTHDR(n, m); 787 m_copy_pkthdr(n, m);
788 n->m_len = m->m_len; 788 n->m_len = m->m_len;
789 if (m->m_flags & M_EXT) { 789 if (m->m_flags & M_EXT) {
790 n->m_data = m->m_data; 790 n->m_data = m->m_data;
791 MCLADDREFERENCE(m, n); 791 MCLADDREFERENCE(m, n);
792 } else { 792 } else {
793 memcpy(mtod(n, char *), mtod(m, char *), n->m_len); 793 memcpy(mtod(n, char *), mtod(m, char *), n->m_len);
794 } 794 }
795 795
796 m = m->m_next; 796 m = m->m_next;
797 while (m) { 797 while (m) {
798 o = m_get(how, m->m_type); 798 o = m_get(how, m->m_type);
799 if (!o) 799 if (!o)
800 goto nospace; 800 goto nospace;

cvs diff -r1.241 -r1.242 src/sys/netinet6/icmp6.c (expand / switch to unified diff)

--- src/sys/netinet6/icmp6.c 2018/12/22 13:11:38 1.241
+++ src/sys/netinet6/icmp6.c 2018/12/22 14:07:54 1.242
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: icmp6.c,v 1.241 2018/12/22 13:11:38 maxv Exp $ */ 1/* $NetBSD: icmp6.c,v 1.242 2018/12/22 14:07:54 maxv Exp $ */
2/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */ 2/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
3 3
4/* 4/*
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -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 * @(#)ip_icmp.c 8.2 (Berkeley) 1/4/94 61 * @(#)ip_icmp.c 8.2 (Berkeley) 1/4/94
62 */ 62 */
63 63
64#include <sys/cdefs.h> 64#include <sys/cdefs.h>
65__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.241 2018/12/22 13:11:38 maxv Exp $"); 65__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.242 2018/12/22 14:07:54 maxv Exp $");
66 66
67#ifdef _KERNEL_OPT 67#ifdef _KERNEL_OPT
68#include "opt_inet.h" 68#include "opt_inet.h"
69#include "opt_ipsec.h" 69#include "opt_ipsec.h"
70#endif 70#endif
71 71
72#include <sys/param.h> 72#include <sys/param.h>
73#include <sys/systm.h> 73#include <sys/systm.h>
74#include <sys/kmem.h> 74#include <sys/kmem.h>
75#include <sys/mbuf.h> 75#include <sys/mbuf.h>
76#include <sys/protosw.h> 76#include <sys/protosw.h>
77#include <sys/socket.h> 77#include <sys/socket.h>
78#include <sys/socketvar.h> 78#include <sys/socketvar.h>
@@ -756,27 +756,27 @@ _icmp6_input(struct mbuf *m, int off, in @@ -756,27 +756,27 @@ _icmp6_input(struct mbuf *m, int off, in
756 maxhlen = hostnamelen; 756 maxhlen = hostnamelen;
757 /* 757 /*
758 * Copy IPv6 and ICMPv6 only. 758 * Copy IPv6 and ICMPv6 only.
759 */ 759 */
760 nip6 = mtod(n, struct ip6_hdr *); 760 nip6 = mtod(n, struct ip6_hdr *);
761 memcpy(nip6, ip6, sizeof(struct ip6_hdr)); 761 memcpy(nip6, ip6, sizeof(struct ip6_hdr));
762 nicmp6 = (struct icmp6_hdr *)(nip6 + 1); 762 nicmp6 = (struct icmp6_hdr *)(nip6 + 1);
763 memcpy(nicmp6, icmp6, sizeof(struct icmp6_hdr)); 763 memcpy(nicmp6, icmp6, sizeof(struct icmp6_hdr));
764 764
765 p = (u_char *)(nicmp6 + 1); 765 p = (u_char *)(nicmp6 + 1);
766 memset(p, 0, 4); 766 memset(p, 0, 4);
767 memcpy(p + 4, hostname, maxhlen); /* meaningless TTL */ 767 memcpy(p + 4, hostname, maxhlen); /* meaningless TTL */
768 768
769 M_COPY_PKTHDR(n, m); 769 m_copy_pkthdr(n, m);
770 n->m_pkthdr.len = n->m_len = sizeof(struct ip6_hdr) + 770 n->m_pkthdr.len = n->m_len = sizeof(struct ip6_hdr) +
771 sizeof(struct icmp6_hdr) + 4 + maxhlen; 771 sizeof(struct icmp6_hdr) + 4 + maxhlen;
772 nicmp6->icmp6_type = ICMP6_WRUREPLY; 772 nicmp6->icmp6_type = ICMP6_WRUREPLY;
773 nicmp6->icmp6_code = 0; 773 nicmp6->icmp6_code = 0;
774 } 774 }
775 if (n) { 775 if (n) {
776 uint64_t *icmp6s = ICMP6_STAT_GETREF(); 776 uint64_t *icmp6s = ICMP6_STAT_GETREF();
777 icmp6s[ICMP6_STAT_REFLECT]++; 777 icmp6s[ICMP6_STAT_REFLECT]++;
778 icmp6s[ICMP6_STAT_OUTHIST + ICMP6_WRUREPLY]++; 778 icmp6s[ICMP6_STAT_OUTHIST + ICMP6_WRUREPLY]++;
779 ICMP6_STAT_PUTREF(); 779 ICMP6_STAT_PUTREF();
780 icmp6_reflect(n, sizeof(struct ip6_hdr)); 780 icmp6_reflect(n, sizeof(struct ip6_hdr));
781 } 781 }
782 break; 782 break;