On Tue, Feb 23, 2021 at 01:09:06PM +0100, Alexander Bluhm wrote:
> On Tue, Feb 23, 2021 at 07:31:30PM +1000, David Gwynne wrote:
> > i'm not a fan of having to cast to caddr_t when we have modern
> > inventions like void *s we can take advantage of.
>
> Shoud you remove all the (caddr_t) casts in the callers then?
i asked coccinelle to have a go, but it has terrible ideas about how to
format code.
> Without that step this diff does not provide more consistency.
it's a start though. cocci and i came up with this to push in after.
Index: arch/armv7/sunxi/sxie.c
===================================================================
RCS file: /cvs/src/sys/arch/armv7/sunxi/sxie.c,v
retrieving revision 1.29
diff -u -p -r1.29 sxie.c
--- arch/armv7/sunxi/sxie.c 10 Jul 2020 13:26:36 -0000 1.29
+++ arch/armv7/sunxi/sxie.c 24 Feb 2021 06:19:13 -0000
@@ -524,7 +524,7 @@ sxie_start(struct ifnet *ifp)
SXIWRITE4(sc, SXIE_TXPKTLEN0 + (fifo * 4), m->m_pkthdr.len);
/* copy the actual packet to fifo XXX through 'align buffer' */
- m_copydata(m, 0, m->m_pkthdr.len, (caddr_t)td);
+ m_copydata(m, 0, m->m_pkthdr.len, td);
bus_space_write_multi_4(sc->sc_iot, sc->sc_ioh,
SXIE_TXIO0,
(uint32_t *)td, SXIE_ROUNDUP(m->m_pkthdr.len, 4) >> 2);
Index: arch/octeon/dev/octcrypto.c
===================================================================
RCS file: /cvs/src/sys/arch/octeon/dev/octcrypto.c,v
retrieving revision 1.3
diff -u -p -r1.3 octcrypto.c
--- arch/octeon/dev/octcrypto.c 10 Mar 2019 14:20:44 -0000 1.3
+++ arch/octeon/dev/octcrypto.c 24 Feb 2021 06:19:13 -0000
@@ -739,7 +739,7 @@ octcrypto_authenc_gmac(struct cryptop *c
} else {
if (crp->crp_flags & CRYPTO_F_IMBUF)
m_copydata((struct mbuf *)crp->crp_buf,
- crde->crd_inject, ivlen, (uint8_t *)iv);
+ crde->crd_inject, ivlen, iv);
else
cuio_copydata((struct uio *)crp->crp_buf,
crde->crd_inject, ivlen, (uint8_t *)iv);
@@ -1035,10 +1035,8 @@ octcrypto_authenc_hmac(struct cryptop *c
memcpy(iv, crde->crd_iv, ivlen);
} else {
if (crp->crp_flags & CRYPTO_F_IMBUF)
- m_copydata(
- (struct mbuf *)crp->crp_buf,
- crde->crd_inject, ivlen,
- (uint8_t *)iv);
+ m_copydata((struct mbuf *)crp->crp_buf,
+ crde->crd_inject, ivlen, iv);
else
cuio_copydata(
(struct uio *)crp->crp_buf,
Index: dev/ic/acx.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/acx.c,v
retrieving revision 1.124
diff -u -p -r1.124 acx.c
--- dev/ic/acx.c 10 Jul 2020 13:26:37 -0000 1.124
+++ dev/ic/acx.c 24 Feb 2021 06:19:13 -0000
@@ -2373,7 +2373,7 @@ acx_set_probe_resp_tmplt(struct acx_soft
IEEE80211_ADDR_COPY(wh->i_addr3, ni->ni_bssid);
*(u_int16_t *)wh->i_seq = 0;
- m_copydata(m, 0, m->m_pkthdr.len, (caddr_t)&resp.data);
+ m_copydata(m, 0, m->m_pkthdr.len, &resp.data);
len = m->m_pkthdr.len + sizeof(resp.size);
m_freem(m);
@@ -2427,7 +2427,7 @@ acx_set_beacon_tmplt(struct acx_softc *s
return (1);
}
- m_copydata(m, 0, off, (caddr_t)&beacon.data);
+ m_copydata(m, 0, off, &beacon.data);
len = off + sizeof(beacon.size);
if (acx_set_tmplt(sc, ACXCMD_TMPLT_BEACON, &beacon, len) != 0) {
@@ -2442,7 +2442,7 @@ acx_set_beacon_tmplt(struct acx_softc *s
return (0);
}
- m_copydata(m, off, len, (caddr_t)&tim.data);
+ m_copydata(m, off, len, &tim.data);
len += sizeof(beacon.size);
m_freem(m);
Index: dev/ic/an.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/an.c,v
retrieving revision 1.77
diff -u -p -r1.77 an.c
--- dev/ic/an.c 8 Dec 2020 04:37:27 -0000 1.77
+++ dev/ic/an.c 24 Feb 2021 06:19:13 -0000
@@ -781,7 +781,7 @@ an_mwrite_bap(struct an_softc *sc, int i
len = min(m->m_len, totlen);
if ((mtod(m, u_long) & 0x1) || (len & 0x1)) {
- m_copydata(m, 0, totlen, (caddr_t)&sc->sc_buf.sc_txbuf);
+ m_copydata(m, 0, totlen, &sc->sc_buf.sc_txbuf);
cnt = (totlen + 1) / 2;
an_swap16((u_int16_t *)&sc->sc_buf.sc_txbuf, cnt);
CSR_WRITE_MULTI_STREAM_2(sc, AN_DATA0,
@@ -1126,7 +1126,7 @@ an_start(struct ifnet *ifp)
if (ic->ic_flags & IEEE80211_F_WEPON)
wh->i_fc[1] |= IEEE80211_FC1_WEP;
m_copydata(m, 0, sizeof(struct ieee80211_frame),
- (caddr_t)&frmhdr.an_whdr);
+ &frmhdr.an_whdr);
an_swap16((u_int16_t *)&frmhdr.an_whdr, sizeof(struct
ieee80211_frame)/2);
/* insert payload length in front of llc/snap */
Index: dev/ic/if_wi.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/if_wi.c,v
retrieving revision 1.174
diff -u -p -r1.174 if_wi.c
--- dev/ic/if_wi.c 10 Jul 2020 13:26:37 -0000 1.174
+++ dev/ic/if_wi.c 24 Feb 2021 06:19:13 -0000
@@ -768,7 +768,7 @@ wi_rxeof(struct wi_softc *sc)
break;
case WI_CRYPTO_SOFTWARE_WEP:
m_copydata(m, 0, m->m_pkthdr.len,
- (caddr_t)sc->wi_rxbuf);
+ sc->wi_rxbuf);
len = m->m_pkthdr.len -
sizeof(struct ether_header);
if (wi_do_hostdecrypt(sc, sc->wi_rxbuf +
@@ -2400,7 +2400,7 @@ nextpkt:
m_copydata(m0, sizeof(struct ether_header),
m0->m_pkthdr.len - sizeof(struct ether_header),
- (caddr_t)&sc->wi_txbuf[12]);
+ &sc->wi_txbuf[12]);
wi_do_hostencrypt(sc, (caddr_t)&sc->wi_txbuf,
tx_frame.wi_dat_len);
@@ -2418,7 +2418,7 @@ nextpkt:
} else {
m_copydata(m0, sizeof(struct ether_header),
m0->m_pkthdr.len - sizeof(struct ether_header),
- (caddr_t)&sc->wi_txbuf);
+ &sc->wi_txbuf);
tx_frame.wi_dat_len = htole16(tx_frame.wi_dat_len);
wi_write_data(sc, id, 0, (caddr_t)&tx_frame,
@@ -2438,8 +2438,7 @@ nextpkt:
": host encrypt not implemented for 802.3\n",
WI_PRT_ARG(sc));
} else {
- m_copydata(m0, 0, m0->m_pkthdr.len,
- (caddr_t)&sc->wi_txbuf);
+ m_copydata(m0, 0, m0->m_pkthdr.len, &sc->wi_txbuf);
wi_write_data(sc, id, 0, (caddr_t)&tx_frame,
sizeof(struct wi_frame));
Index: dev/pci/if_bwfm_pci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_bwfm_pci.c,v
retrieving revision 1.39
diff -u -p -r1.39 if_bwfm_pci.c
--- dev/pci/if_bwfm_pci.c 31 Jan 2021 11:07:51 -0000 1.39
+++ dev/pci/if_bwfm_pci.c 24 Feb 2021 06:19:13 -0000
@@ -2017,7 +2017,7 @@ bwfm_pci_msgbuf_query_dcmd(struct bwfm_s
*len = min(ctl->retlen, m->m_len);
*len = min(*len, buflen);
if (buf)
- m_copydata(ctl->m, 0, *len, (caddr_t)buf);
+ m_copydata(ctl->m, 0, *len, buf);
m_freem(ctl->m);
if (ctl->status < 0) {
Index: dev/pci/if_mcx.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_mcx.c,v
retrieving revision 1.99
diff -u -p -r1.99 if_mcx.c
--- dev/pci/if_mcx.c 15 Feb 2021 03:42:00 -0000 1.99
+++ dev/pci/if_mcx.c 24 Feb 2021 06:19:13 -0000
@@ -7754,7 +7754,7 @@ mcx_start(struct ifqueue *ifq)
&sqe->sqe_inline_headers;
/* slightly cheaper vlan_inject() */
- m_copydata(m, 0, ETHER_HDR_LEN, (caddr_t)evh);
+ m_copydata(m, 0, ETHER_HDR_LEN, evh);
evh->evl_proto = evh->evl_encap_proto;
evh->evl_encap_proto = htons(ETHERTYPE_VLAN);
evh->evl_tag = htons(m->m_pkthdr.ether_vtag);
@@ -7764,7 +7764,7 @@ mcx_start(struct ifqueue *ifq)
#endif
{
m_copydata(m, 0, MCX_SQ_INLINE_SIZE,
- (caddr_t)sqe->sqe_inline_headers);
+ sqe->sqe_inline_headers);
m_adj(m, MCX_SQ_INLINE_SIZE);
}
Index: dev/pci/safe.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/safe.c,v
retrieving revision 1.44
diff -u -p -r1.44 safe.c
--- dev/pci/safe.c 29 May 2020 04:42:25 -0000 1.44
+++ dev/pci/safe.c 24 Feb 2021 06:19:13 -0000
@@ -467,7 +467,7 @@ safe_process(struct cryptop *crp)
bcopy(enccrd->crd_iv, iv, ivsize);
else if (crp->crp_flags & CRYPTO_F_IMBUF)
m_copydata(re->re_src_m, enccrd->crd_inject,
- ivsize, (caddr_t)iv);
+ ivsize, iv);
else if (crp->crp_flags & CRYPTO_F_IOV)
cuio_copydata(re->re_src_io, enccrd->crd_inject,
ivsize, (caddr_t)iv);
Index: dev/pci/ubsec.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/ubsec.c,v
retrieving revision 1.166
diff -u -p -r1.166 ubsec.c
--- dev/pci/ubsec.c 29 May 2020 04:42:25 -0000 1.166
+++ dev/pci/ubsec.c 24 Feb 2021 06:19:13 -0000
@@ -927,7 +927,7 @@ ubsec_process(struct cryptop *crp)
bcopy(enccrd->crd_iv, key.ses_iv, ivlen);
else if (crp->crp_flags & CRYPTO_F_IMBUF)
m_copydata(q->q_src_m, enccrd->crd_inject,
- ivlen, (caddr_t)key.ses_iv);
+ ivlen, key.ses_iv);
else if (crp->crp_flags & CRYPTO_F_IOV)
cuio_copydata(q->q_src_io,
enccrd->crd_inject, ivlen,
Index: dev/usb/if_athn_usb.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_athn_usb.c,v
retrieving revision 1.59
diff -u -p -r1.59 if_athn_usb.c
--- dev/usb/if_athn_usb.c 30 Nov 2020 16:09:33 -0000 1.59
+++ dev/usb/if_athn_usb.c 24 Feb 2021 06:19:13 -0000
@@ -1766,7 +1766,7 @@ athn_usb_swba(struct athn_usb_softc *usc
memset(bcn, 0, sizeof(*bcn));
bcn->vif_idx = 0;
- m_copydata(m, 0, m->m_pkthdr.len, (caddr_t)&bcn[1]);
+ m_copydata(m, 0, m->m_pkthdr.len, &bcn[1]);
usbd_setup_xfer(data->xfer, usc->tx_data_pipe, data, data->buf,
sizeof(*hdr) + sizeof(*htc) + sizeof(*bcn) + m->m_pkthdr.len,
@@ -2377,7 +2377,7 @@ athn_usb_tx(struct athn_softc *sc, struc
frm = (uint8_t *)&txm[1];
}
/* Copy payload. */
- m_copydata(m, 0, m->m_pkthdr.len, (caddr_t)frm);
+ m_copydata(m, 0, m->m_pkthdr.len, frm);
frm += m->m_pkthdr.len;
m_freem(m);
Index: dev/usb/if_otus.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_otus.c,v
retrieving revision 1.68
diff -u -p -r1.68 if_otus.c
--- dev/usb/if_otus.c 30 Nov 2020 16:09:33 -0000 1.68
+++ dev/usb/if_otus.c 24 Feb 2021 06:19:13 -0000
@@ -1380,7 +1380,7 @@ otus_tx(struct otus_softc *sc, struct mb
#endif
xferlen = sizeof (*head) + m->m_pkthdr.len;
- m_copydata(m, 0, m->m_pkthdr.len, (caddr_t)&head[1]);
+ m_copydata(m, 0, m->m_pkthdr.len, &head[1]);
m_freem(m);
DPRINTFN(5, ("tx queued=%d len=%d mac=0x%04x phy=0x%08x rate=%d\n",
Index: dev/usb/if_rsu.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_rsu.c,v
retrieving revision 1.48
diff -u -p -r1.48 if_rsu.c
--- dev/usb/if_rsu.c 30 Nov 2020 16:09:33 -0000 1.48
+++ dev/usb/if_rsu.c 24 Feb 2021 06:19:13 -0000
@@ -1609,7 +1609,7 @@ rsu_tx(struct rsu_softc *sc, struct mbuf
#endif
xferlen = sizeof(*txd) + m->m_pkthdr.len;
- m_copydata(m, 0, m->m_pkthdr.len, (caddr_t)&txd[1]);
+ m_copydata(m, 0, m->m_pkthdr.len, &txd[1]);
m_freem(m);
data->pipe = pipe;
Index: dev/usb/if_uath.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_uath.c,v
retrieving revision 1.86
diff -u -p -r1.86 if_uath.c
--- dev/usb/if_uath.c 12 Dec 2020 11:48:54 -0000 1.86
+++ dev/usb/if_uath.c 24 Feb 2021 06:19:13 -0000
@@ -1398,14 +1398,14 @@ uath_tx_data(struct uath_softc *sc, stru
*frm++ = (iv >> 16) & 0xff;
*frm++ = ic->ic_wep_txkey << 6;
- m_copydata(m0, sizeof (struct ieee80211_frame),
- m0->m_pkthdr.len - sizeof (struct ieee80211_frame), frm);
+ m_copydata(m0, sizeof(struct ieee80211_frame),
+ m0->m_pkthdr.len - sizeof(struct ieee80211_frame), frm);
paylen += IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN;
xferlen += IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN;
totlen = xferlen + IEEE80211_WEP_CRCLEN;
} else {
- m_copydata(m0, 0, m0->m_pkthdr.len, (uint8_t *)(desc + 1));
+ m_copydata(m0, 0, m0->m_pkthdr.len, desc + 1);
totlen = xferlen;
}
Index: dev/usb/if_urtw.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_urtw.c,v
retrieving revision 1.69
diff -u -p -r1.69 if_urtw.c
--- dev/usb/if_urtw.c 10 Jul 2020 13:22:21 -0000 1.69
+++ dev/usb/if_urtw.c 24 Feb 2021 06:19:13 -0000
@@ -2649,10 +2649,10 @@ urtw_tx_start(struct urtw_softc *sc, str
data->buf[8] = 3; /* CW minimum */
data->buf[8] |= (7 << 4); /* CW maximum */
data->buf[9] |= 11; /* retry limitation */
- m_copydata(m0, 0, m0->m_pkthdr.len, (uint8_t *)&data->buf[12]);
+ m_copydata(m0, 0, m0->m_pkthdr.len, &data->buf[12]);
} else {
data->buf[21] |= 11; /* retry limitation */
- m_copydata(m0, 0, m0->m_pkthdr.len, (uint8_t *)&data->buf[32]);
+ m_copydata(m0, 0, m0->m_pkthdr.len, &data->buf[32]);
}
data->ni = ni;
Index: net/bridgectl.c
===================================================================
RCS file: /cvs/src/sys/net/bridgectl.c,v
retrieving revision 1.23
diff -u -p -r1.23 bridgectl.c
--- net/bridgectl.c 28 Jan 2021 20:06:38 -0000 1.23
+++ net/bridgectl.c 24 Feb 2021 06:19:13 -0000
@@ -667,9 +667,9 @@ bridge_arpfilter(struct brl_node *n, str
if (ntohs(eh->ether_type) != ETHERTYPE_ARP)
return (0);
- if (m->m_pkthdr.len <= ETHER_HDR_LEN + sizeof(ea))
+ if (m->m_pkthdr.len < ETHER_HDR_LEN + sizeof(ea))
return (0); /* log error? */
- m_copydata(m, ETHER_HDR_LEN, sizeof(ea), (caddr_t)&ea);
+ m_copydata(m, ETHER_HDR_LEN, sizeof(ea), &ea);
if (ntohs(ea.arp_hrd) != ARPHRD_ETHER ||
ntohs(ea.arp_pro) != ETHERTYPE_IP ||
Index: net/if_bridge.c
===================================================================
RCS file: /cvs/src/sys/net/if_bridge.c,v
retrieving revision 1.351
diff -u -p -r1.351 if_bridge.c
--- net/if_bridge.c 23 Feb 2021 11:44:53 -0000 1.351
+++ net/if_bridge.c 24 Feb 2021 06:19:13 -0000
@@ -958,7 +958,7 @@ bridgeintr_frame(struct ifnet *brifp, st
bif = bridge_getbif(src_if);
KASSERT(bif != NULL);
- m_copydata(m, 0, ETHER_HDR_LEN, (caddr_t)&eh);
+ m_copydata(m, 0, ETHER_HDR_LEN, &eh);
dst = (struct ether_addr *)&eh.ether_dhost[0];
src = (struct ether_addr *)&eh.ether_shost[0];
@@ -1457,8 +1457,7 @@ bridge_blocknonip(struct ether_header *e
(ETHER_HDR_LEN + LLC_SNAPFRAMELEN))
return (1);
- m_copydata(m, ETHER_HDR_LEN, LLC_SNAPFRAMELEN,
- (caddr_t)&llc);
+ m_copydata(m, ETHER_HDR_LEN, LLC_SNAPFRAMELEN, &llc);
etype = ntohs(llc.llc_snap.ether_type);
if (llc.llc_dsap == LLC_SNAP_LSAP &&
@@ -1512,8 +1511,7 @@ bridge_ipsec(struct ifnet *ifp, struct e
dst.sa.sa_family = AF_INET;
dst.sin.sin_len = sizeof(struct sockaddr_in);
m_copydata(m, offsetof(struct ip, ip_dst),
- sizeof(struct in_addr),
- (caddr_t)&dst.sin.sin_addr);
+ sizeof(struct in_addr), &dst.sin.sin_addr);
break;
#ifdef INET6
@@ -1535,8 +1533,7 @@ bridge_ipsec(struct ifnet *ifp, struct e
dst.sa.sa_family = AF_INET6;
dst.sin6.sin6_len = sizeof(struct sockaddr_in6);
m_copydata(m, offsetof(struct ip6_hdr, ip6_dst),
- sizeof(struct in6_addr),
- (caddr_t)&dst.sin6.sin6_addr);
+ sizeof(struct in6_addr), &dst.sin6.sin6_addr);
break;
#endif /* INET6 */
@@ -1546,15 +1543,15 @@ bridge_ipsec(struct ifnet *ifp, struct e
switch (proto) {
case IPPROTO_ESP:
- m_copydata(m, hlen, sizeof(u_int32_t), (caddr_t)&spi);
+ m_copydata(m, hlen, sizeof(u_int32_t), &spi);
break;
case IPPROTO_AH:
m_copydata(m, hlen + sizeof(u_int32_t),
- sizeof(u_int32_t), (caddr_t)&spi);
+ sizeof(u_int32_t), &spi);
break;
case IPPROTO_IPCOMP:
m_copydata(m, hlen + sizeof(u_int16_t),
- sizeof(u_int16_t), (caddr_t)&cpi);
+ sizeof(u_int16_t), &cpi);
spi = htonl(ntohs(cpi));
break;
}
@@ -1654,8 +1651,7 @@ bridge_ip(struct ifnet *brifp, int dir,
ETHER_HDR_LEN))
return (m);
- m_copydata(m, ETHER_HDR_LEN,
- LLC_SNAPFRAMELEN, (caddr_t)&llc);
+ m_copydata(m, ETHER_HDR_LEN, LLC_SNAPFRAMELEN, &llc);
if (llc.llc_dsap != LLC_SNAP_LSAP ||
llc.llc_ssap != LLC_SNAP_LSAP ||
@@ -1885,8 +1881,7 @@ bridge_fragment(struct ifnet *brifp, str
ETHER_HDR_LEN))
goto dropit;
- m_copydata(m, ETHER_HDR_LEN,
- LLC_SNAPFRAMELEN, (caddr_t)&llc);
+ m_copydata(m, ETHER_HDR_LEN, LLC_SNAPFRAMELEN, &llc);
if (llc.llc_dsap != LLC_SNAP_LSAP ||
llc.llc_ssap != LLC_SNAP_LSAP ||
Index: net/if_pfsync.c
===================================================================
RCS file: /cvs/src/sys/net/if_pfsync.c,v
retrieving revision 1.286
diff -u -p -r1.286 if_pfsync.c
--- net/if_pfsync.c 19 Feb 2021 06:14:07 -0000 1.286
+++ net/if_pfsync.c 24 Feb 2021 06:19:13 -0000
@@ -792,7 +792,7 @@ pfsync_input(struct mbuf **mp, int *offp
offset += sizeof(*ph);
while (offset <= len - sizeof(subh)) {
- m_copydata(m, offset, sizeof(subh), (caddr_t)&subh);
+ m_copydata(m, offset, sizeof(subh), &subh);
offset += sizeof(subh);
mlen = subh.len << 2;
Index: net/if_pppx.c
===================================================================
RCS file: /cvs/src/sys/net/if_pppx.c,v
retrieving revision 1.109
diff -u -p -r1.109 if_pppx.c
--- net/if_pppx.c 10 Feb 2021 13:38:46 -0000 1.109
+++ net/if_pppx.c 24 Feb 2021 06:19:13 -0000
@@ -1441,7 +1441,7 @@ pppac_qstart(struct ifqueue *ifq)
case AF_INET:
if (m->m_pkthdr.len < sizeof(struct ip))
goto bad;
- m_copydata(m, 0, sizeof(struct ip), (caddr_t)&ip);
+ m_copydata(m, 0, sizeof(struct ip), &ip);
if (IN_MULTICAST(ip.ip_dst.s_addr)) {
/* pass a copy to pipex */
m0 = m_copym(m, 0, M_COPYALL, M_NOWAIT);
Index: net/if_switch.c
===================================================================
RCS file: /cvs/src/sys/net/if_switch.c,v
retrieving revision 1.40
diff -u -p -r1.40 if_switch.c
--- net/if_switch.c 19 Jan 2021 19:39:14 -0000 1.40
+++ net/if_switch.c 24 Feb 2021 06:19:13 -0000
@@ -690,7 +690,7 @@ switch_port_ingress(struct switch_softc
sc->sc_if.if_ipackets++;
sc->sc_if.if_ibytes += m->m_pkthdr.len;
- m_copydata(m, 0, ETHER_HDR_LEN, (caddr_t)&eh);
+ m_copydata(m, 0, ETHER_HDR_LEN, &eh);
#if 0
/* It's the "#if 0" because it doesn't test switch(4) with pf(4)
* or with ipsec(4).
@@ -720,7 +720,7 @@ switch_port_egress(struct switch_softc *
bpf_mtap(sc->sc_if.if_bpf, m, BPF_DIRECTION_OUT);
#endif
- m_copydata(m, 0, ETHER_HDR_LEN, (caddr_t)&eh);
+ m_copydata(m, 0, ETHER_HDR_LEN, &eh);
TAILQ_FOREACH(swpo, fwdp_q, swpo_fwdp_next) {
if ((dst_if = if_get(swpo->swpo_ifindex)) == NULL)
@@ -1547,7 +1547,7 @@ ofp_split_mbuf(struct mbuf *m, struct mb
return (-1);
m_copydata(m, offsetof(struct ofp_header, oh_length), sizeof(ohlen),
- (caddr_t)&ohlen);
+ &ohlen);
ohlen = ntohs(ohlen);
/* We got an invalid packet header, skip it. */
Index: net/if_vlan.c
===================================================================
RCS file: /cvs/src/sys/net/if_vlan.c,v
retrieving revision 1.205
diff -u -p -r1.205 if_vlan.c
--- net/if_vlan.c 21 Jan 2021 13:17:13 -0000 1.205
+++ net/if_vlan.c 24 Feb 2021 06:19:13 -0000
@@ -340,7 +340,7 @@ vlan_inject(struct mbuf *m, uint16_t typ
{
struct ether_vlan_header evh;
- m_copydata(m, 0, ETHER_HDR_LEN, (caddr_t)&evh);
+ m_copydata(m, 0, ETHER_HDR_LEN, &evh);
evh.evl_proto = evh.evl_encap_proto;
evh.evl_encap_proto = htons(type);
evh.evl_tag = htons(tag);
Index: net/if_vxlan.c
===================================================================
RCS file: /cvs/src/sys/net/if_vxlan.c,v
retrieving revision 1.81
diff -u -p -r1.81 if_vxlan.c
--- net/if_vxlan.c 21 Aug 2020 22:59:27 -0000 1.81
+++ net/if_vxlan.c 24 Feb 2021 06:19:13 -0000
@@ -637,7 +637,7 @@ vxlan_lookup(struct mbuf *m, struct udph
skip = iphlen + sizeof(*uh);
if (m->m_pkthdr.len - skip < sizeof(v))
return (0);
- m_copydata(m, skip, sizeof(v), (caddr_t)&v);
+ m_copydata(m, skip, sizeof(v), &v);
skip += sizeof(v);
if (v.vxlan_flags & htonl(VXLAN_RESERVED1) ||
Index: net/pipex.c
===================================================================
RCS file: /cvs/src/sys/net/pipex.c,v
retrieving revision 1.130
diff -u -p -r1.130 pipex.c
--- net/pipex.c 19 Jan 2021 19:37:42 -0000 1.130
+++ net/pipex.c 24 Feb 2021 06:19:13 -0000
@@ -991,7 +991,7 @@ pipex_common_input(struct pipex_session
case PPP_CCP:
code = 0;
KASSERT(m0->m_pkthdr.len >= hlen + ppphlen + 1);
- m_copydata(m0, hlen + ppphlen, 1, (caddr_t)&code);
+ m_copydata(m0, hlen + ppphlen, 1, &code);
if (code != CCP_RESETREQ && code != CCP_RESETACK)
goto not_ours;
break;
@@ -1096,7 +1096,7 @@ pipex_pppoe_lookup_session(struct mbuf *
return (NULL);
m_copydata(m0, sizeof(struct ether_header),
- sizeof(struct pipex_pppoe_header), (caddr_t)&pppoe);
+ sizeof(struct pipex_pppoe_header), &pppoe);
pppoe.session_id = ntohs(pppoe.session_id);
session = pipex_lookup_by_session_id(PIPEX_PROTO_PPPOE,
pppoe.session_id);
@@ -1123,7 +1123,7 @@ pipex_pppoe_input(struct mbuf *m0, struc
sizeof(pppoe)));
m_copydata(m0, sizeof(struct ether_header),
- sizeof(struct pipex_pppoe_header), (caddr_t)&pppoe);
+ sizeof(struct pipex_pppoe_header), &pppoe);
hlen = sizeof(struct ether_header) + sizeof(struct pipex_pppoe_header);
if ((m0 = pipex_common_input(session, m0, hlen, ntohs(pppoe.length)))
@@ -1287,7 +1287,7 @@ pipex_pptp_lookup_session(struct mbuf *m
}
/* get ip header info */
- m_copydata(m0, 0, sizeof(struct ip), (caddr_t)&ip);
+ m_copydata(m0, 0, sizeof(struct ip), &ip);
hlen = ip.ip_hl << 2;
/*
@@ -1296,7 +1296,7 @@ pipex_pptp_lookup_session(struct mbuf *m
*/
/* get gre flags */
- m_copydata(m0, hlen, sizeof(gre), (caddr_t)&gre);
+ m_copydata(m0, hlen, sizeof(gre), &gre);
flags = ntohs(gre.flags);
/* gre version must be '1' */
@@ -1521,7 +1521,7 @@ pipex_pptp_userland_lookup_session(struc
}
/* get flags */
- m_copydata(m0, 0, sizeof(struct pipex_gre_header), (caddr_t)&gre);
+ m_copydata(m0, 0, sizeof(struct pipex_gre_header), &gre);
flags = ntohs(gre.flags);
/* gre version must be '1' */
@@ -1571,7 +1571,7 @@ pipex_pptp_userland_output(struct mbuf *
uint32_t val32;
len = sizeof(struct pipex_gre_header);
- m_copydata(m0, 0, len, (caddr_t)&gre0);
+ m_copydata(m0, 0, len, &gre0);
gre = &gre0;
flags = ntohs(gre->flags);
if ((flags & PIPEX_GRE_SFLAG) != 0)
@@ -1801,7 +1801,7 @@ pipex_l2tp_input(struct mbuf *m0, int of
l2tp_session->ipsecflowinfo = ipsecflowinfo;
nsp = nrp = NULL;
- m_copydata(m0, off0, sizeof(flags), (caddr_t)&flags);
+ m_copydata(m0, off0, sizeof(flags), &flags);
flags = ntohs(flags) & PIPEX_L2TP_FLAG_MASK;
KASSERT((flags & PIPEX_L2TP_FLAG_TYPE) == 0);
@@ -1953,7 +1953,7 @@ pipex_l2tp_userland_lookup_session(struc
}
/* get flags */
- m_copydata(m0, 0, sizeof(l2tp), (caddr_t)&l2tp);
+ m_copydata(m0, 0, sizeof(l2tp), &l2tp);
flags = ntohs(l2tp.flagsver);
/* l2tp version must be '2' */
Index: net/rtsock.c
===================================================================
RCS file: /cvs/src/sys/net/rtsock.c,v
retrieving revision 1.305
diff -u -p -r1.305 rtsock.c
--- net/rtsock.c 15 Feb 2021 19:01:30 -0000 1.305
+++ net/rtsock.c 24 Feb 2021 06:19:13 -0000
@@ -724,7 +724,7 @@ route_output(struct mbuf *m, struct sock
goto fail;
}
rtm = malloc(len, M_RTABLE, M_WAITOK);
- m_copydata(m, 0, len, (caddr_t)rtm);
+ m_copydata(m, 0, len, rtm);
break;
default:
error = EPROTONOSUPPORT;
Index: net/switchofp.c
===================================================================
RCS file: /cvs/src/sys/net/switchofp.c,v
retrieving revision 1.78
diff -u -p -r1.78 switchofp.c
--- net/switchofp.c 19 Jan 2021 19:39:14 -0000 1.78
+++ net/switchofp.c 24 Feb 2021 06:19:13 -0000
@@ -3261,7 +3261,7 @@ swofp_action_pop_vlan(struct switch_soft
return (NULL);
}
- m_copydata(m, 0, ETHER_HDR_LEN, (caddr_t)&eh);
+ m_copydata(m, 0, ETHER_HDR_LEN, &eh);
eh.ether_type = evl->evl_proto;
m_adj(m, sizeof(*evl));
@@ -3346,7 +3346,7 @@ swofp_action_push_vlan(struct switch_sof
swfcl->swfcl_vlan->vlan_vid = htons(1);
}
- m_copydata(m, 0, ETHER_HDR_LEN, (caddr_t)&evh);
+ m_copydata(m, 0, ETHER_HDR_LEN, &evh);
evh.evl_proto = evh.evl_encap_proto;
evh.evl_encap_proto = oap->ap_ethertype;
evh.evl_tag = (swfcl->swfcl_vlan->vlan_vid |
@@ -5481,7 +5481,7 @@ swofp_group_mod_add(struct switch_softc
}
m_copydata(m, offsetof(struct ofp_group_mod, gm_buckets),
- swge->swge_buckets_len, (caddr_t)swge->swge_buckets);
+ swge->swge_buckets_len, swge->swge_buckets);
}
swofp_group_entry_add(sc, swge);
@@ -5541,7 +5541,7 @@ swofp_group_mod_modify(struct switch_sof
if (swge->swge_buckets != NULL)
m_copydata(m, offsetof(struct ofp_group_mod, gm_buckets),
- swge->swge_buckets_len, (caddr_t)swge->swge_buckets);
+ swge->swge_buckets_len, swge->swge_buckets);
m_freem(m);
return (0);
Index: netinet/ip_ah.c
===================================================================
RCS file: /cvs/src/sys/netinet/ip_ah.c,v
retrieving revision 1.145
diff -u -p -r1.145 ip_ah.c
--- netinet/ip_ah.c 18 Dec 2020 12:30:23 -0000 1.145
+++ netinet/ip_ah.c 24 Feb 2021 06:19:13 -0000
@@ -327,7 +327,7 @@ ah_massage_headers(struct mbuf **m0, int
#ifdef INET6
case AF_INET6: /* Ugly... */
/* Copy and "cook" the IPv6 header. */
- m_copydata(m, 0, sizeof(ip6), (caddr_t) &ip6);
+ m_copydata(m, 0, sizeof(ip6), &ip6);
/* We don't do IPv6 Jumbograms. */
if (ip6.ip6_plen == 0) {
@@ -464,8 +464,7 @@ ah_massage_headers(struct mbuf **m0, int
sizeof(struct in6_addr) *
(rh0->ip6r0_segleft - 1));
- m_copydata(m, 0, sizeof(ip6),
- (caddr_t)&ip6);
+ m_copydata(m, 0, sizeof(ip6), &ip6);
addr[0] = ip6.ip6_dst;
ip6.ip6_dst = finaldst;
error = m_copyback(m, 0, sizeof(ip6),
@@ -539,13 +538,12 @@ ah_input(struct mbuf *m, struct tdb *tdb
rplen = AH_FLENGTH + sizeof(u_int32_t);
/* Save the AH header, we use it throughout. */
- m_copydata(m, skip + offsetof(struct ah, ah_hl), sizeof(u_int8_t),
- (caddr_t) &hl);
+ m_copydata(m, skip + offsetof(struct ah, ah_hl), sizeof(u_int8_t), &hl);
/* Replay window checking, if applicable. */
if (tdb->tdb_wnd > 0) {
m_copydata(m, skip + offsetof(struct ah, ah_rpl),
- sizeof(u_int32_t), (caddr_t) &btsx);
+ sizeof(u_int32_t), &btsx);
btsx = ntohl(btsx);
switch (checkreplaywindow(tdb, btsx, &esn, 0)) {
@@ -668,7 +666,7 @@ ah_input(struct mbuf *m, struct tdb *tdb
* Save the authenticator, the skipped portion of the packet,
* and the AH header.
*/
- m_copydata(m, 0, skip + rplen + ahx->authsize, (caddr_t) (tc + 1));
+ m_copydata(m, 0, skip + rplen + ahx->authsize, tc + 1);
/* Zeroize the authenticator on the packet. */
m_copyback(m, skip + rplen, ahx->authsize, ipseczeroes, M_NOWAIT);
@@ -751,7 +749,7 @@ ah_input_cb(struct tdb *tdb, struct tdb_
/* Replay window checking, if applicable. */
if (tdb->tdb_wnd > 0) {
m_copydata(m, skip + offsetof(struct ah, ah_rpl),
- sizeof(u_int32_t), (caddr_t) &btsx);
+ sizeof(u_int32_t), &btsx);
btsx = ntohl(btsx);
switch (checkreplaywindow(tdb, btsx, &esn, 1)) {
@@ -1034,7 +1032,7 @@ ah_output(struct mbuf *m, struct tdb *td
ah = (struct ah *)(mtod(mi, caddr_t) + roff);
/* Initialize the AH header. */
- m_copydata(m, protoff, sizeof(u_int8_t), (caddr_t) &ah->ah_nh);
+ m_copydata(m, protoff, sizeof(u_int8_t), &ah->ah_nh);
ah->ah_hl = (rplen + ahx->authsize - AH_FLENGTH) / sizeof(u_int32_t);
ah->ah_rv = 0;
ah->ah_spi = tdb->tdb_spi;
@@ -1087,7 +1085,7 @@ ah_output(struct mbuf *m, struct tdb *td
}
/* Save the skipped portion of the packet. */
- m_copydata(m, 0, skip, (caddr_t) (tc + 1));
+ m_copydata(m, 0, skip, tc + 1);
/*
* Fix IP header length on the header used for
Index: netinet/ip_esp.c
===================================================================
RCS file: /cvs/src/sys/netinet/ip_esp.c,v
retrieving revision 1.161
diff -u -p -r1.161 ip_esp.c
--- netinet/ip_esp.c 18 Dec 2020 12:30:23 -0000 1.161
+++ netinet/ip_esp.c 24 Feb 2021 06:19:13 -0000
@@ -373,7 +373,7 @@ esp_input(struct mbuf *m, struct tdb *td
/* Replay window checking, if appropriate -- no value commitment. */
if (tdb->tdb_wnd > 0) {
m_copydata(m, skip + sizeof(u_int32_t), sizeof(u_int32_t),
- (unsigned char *) &btsx);
+ &btsx);
btsx = ntohl(btsx);
switch (checkreplaywindow(tdb, btsx, &esn, 0)) {
@@ -484,7 +484,7 @@ esp_input(struct mbuf *m, struct tdb *td
crda->crd_len = m->m_pkthdr.len - (skip + alen);
/* Copy the authenticator */
- m_copydata(m, m->m_pkthdr.len - alen, alen, (caddr_t)(tc + 1));
+ m_copydata(m, m->m_pkthdr.len - alen, alen, tc + 1);
} else
crde = &crp->crp_desc[0];
@@ -576,7 +576,7 @@ esp_input_cb(struct tdb *tdb, struct tdb
/* Replay window checking, if appropriate */
if (tdb->tdb_wnd > 0) {
m_copydata(m, skip + sizeof(u_int32_t), sizeof(u_int32_t),
- (unsigned char *) &btsx);
+ &btsx);
btsx = ntohl(btsx);
switch (checkreplaywindow(tdb, btsx, &esn, 1)) {
Index: netinet/ip_icmp.c
===================================================================
RCS file: /cvs/src/sys/netinet/ip_icmp.c,v
retrieving revision 1.184
diff -u -p -r1.184 ip_icmp.c
--- netinet/ip_icmp.c 20 Dec 2020 21:15:47 -0000 1.184
+++ netinet/ip_icmp.c 24 Feb 2021 06:19:13 -0000
@@ -259,7 +259,7 @@ icmp_do_error(struct mbuf *n, int type,
}
icp->icmp_code = code;
- m_copydata(n, 0, icmplen, (caddr_t)&icp->icmp_ip);
+ m_copydata(n, 0, icmplen, &icp->icmp_ip);
/*
* Now, copy old ip header (without options)
Index: netinet/tcp_subr.c
===================================================================
RCS file: /cvs/src/sys/netinet/tcp_subr.c,v
retrieving revision 1.175
diff -u -p -r1.175 tcp_subr.c
--- netinet/tcp_subr.c 24 Jul 2020 20:39:03 -0000 1.175
+++ netinet/tcp_subr.c 24 Feb 2021 06:19:13 -0000
@@ -654,7 +654,7 @@ tcp6_ctlinput(int cmd, struct sockaddr *
return;
bzero(&th, sizeof(th));
- m_copydata(m, off, sizeof(*thp), (caddr_t)&th);
+ m_copydata(m, off, sizeof(*thp), &th);
/*
* Check to see if we have a valid TCP connection
Index: netinet6/ip6_input.c
===================================================================
RCS file: /cvs/src/sys/netinet6/ip6_input.c,v
retrieving revision 1.230
diff -u -p -r1.230 ip6_input.c
--- netinet6/ip6_input.c 16 Nov 2020 06:44:39 -0000 1.230
+++ netinet6/ip6_input.c 24 Feb 2021 06:19:13 -0000
@@ -650,7 +650,7 @@ ip6_check_rh0hdr(struct mbuf *m, int *of
return (1);
}
- m_copydata(m, off, sizeof(rthdr), (caddr_t)&rthdr);
+ m_copydata(m, off, sizeof(rthdr), &rthdr);
if (rthdr.ip6r_type == IPV6_RTHDR_TYPE_0) {
*offp += offsetof(struct ip6_rthdr, ip6r_type);
@@ -673,7 +673,7 @@ ip6_check_rh0hdr(struct mbuf *m, int *of
return (0);
}
- m_copydata(m, off, sizeof(opt6), (caddr_t)&opt6);
+ m_copydata(m, off, sizeof(opt6), &opt6);
if (proto == IPPROTO_AH)
off += (opt6.ip6e_len + 2) * 4;
@@ -1143,7 +1143,7 @@ ip6_pullexthdr(struct mbuf *m, size_t of
if (off + sizeof(ip6e) > m->m_pkthdr.len)
return NULL;
- m_copydata(m, off, sizeof(ip6e), (caddr_t)&ip6e);
+ m_copydata(m, off, sizeof(ip6e), &ip6e);
if (nxt == IPPROTO_AH)
elen = (ip6e.ip6e_len + 2) << 2;
else
@@ -1195,7 +1195,7 @@ ip6_get_prevhdr(struct mbuf *m, int off)
len = sizeof(struct ip6_hdr);
nlen = 0;
while (len < off) {
- m_copydata(m, len, sizeof(ip6e), (caddr_t)&ip6e);
+ m_copydata(m, len, sizeof(ip6e), &ip6e);
switch (nxt) {
case IPPROTO_FRAGMENT:
@@ -1236,7 +1236,7 @@ ip6_nexthdr(struct mbuf *m, int off, int
case IPPROTO_IPV6:
if (m->m_pkthdr.len < off + sizeof(ip6))
return -1;
- m_copydata(m, off, sizeof(ip6), (caddr_t)&ip6);
+ m_copydata(m, off, sizeof(ip6), &ip6);
if (nxtp)
*nxtp = ip6.ip6_nxt;
off += sizeof(ip6);
@@ -1249,7 +1249,7 @@ ip6_nexthdr(struct mbuf *m, int off, int
*/
if (m->m_pkthdr.len < off + sizeof(fh))
return -1;
- m_copydata(m, off, sizeof(fh), (caddr_t)&fh);
+ m_copydata(m, off, sizeof(fh), &fh);
if ((fh.ip6f_offlg & IP6F_OFF_MASK) != 0)
return -1;
if (nxtp)
@@ -1260,7 +1260,7 @@ ip6_nexthdr(struct mbuf *m, int off, int
case IPPROTO_AH:
if (m->m_pkthdr.len < off + sizeof(ip6e))
return -1;
- m_copydata(m, off, sizeof(ip6e), (caddr_t)&ip6e);
+ m_copydata(m, off, sizeof(ip6e), &ip6e);
if (nxtp)
*nxtp = ip6e.ip6e_nxt;
off += (ip6e.ip6e_len + 2) << 2;
@@ -1273,7 +1273,7 @@ ip6_nexthdr(struct mbuf *m, int off, int
case IPPROTO_DSTOPTS:
if (m->m_pkthdr.len < off + sizeof(ip6e))
return -1;
- m_copydata(m, off, sizeof(ip6e), (caddr_t)&ip6e);
+ m_copydata(m, off, sizeof(ip6e), &ip6e);
if (nxtp)
*nxtp = ip6e.ip6e_nxt;
off += (ip6e.ip6e_len + 1) << 3;