Hello -

Convert bcopy to memcpy where the memory does not overlap, otherwise,
use memmove.  While here, change some previous conversions to a simple
assignment.

OK?

Index: ip_esp.c
===================================================================
RCS file: /cvs/src/sys/netinet/ip_esp.c,v
retrieving revision 1.146
diff -u -p -r1.146 ip_esp.c
--- ip_esp.c    7 Feb 2017 18:18:16 -0000       1.146
+++ ip_esp.c    6 Apr 2017 15:21:27 -0000
@@ -504,7 +504,7 @@ esp_input(struct mbuf *m, struct tdb *td
        tc->tc_spi = tdb->tdb_spi;
        tc->tc_proto = tdb->tdb_sproto;
        tc->tc_rdomain = tdb->tdb_rdomain;
-       memcpy(&tc->tc_dst, &tdb->tdb_dst, sizeof(union sockaddr_union));
+       tc->tc_dst = tdb->tdb_dst;
 
        /* Decryption descriptor */
        if (espx) {
@@ -707,8 +707,9 @@ esp_input_cb(struct cryptop *crp)
                 * overlapping copy of the remainder of the mbuf over the ESP
                 * header.
                 */
-               bcopy(mtod(m1, u_char *) + roff + hlen,
-                   mtod(m1, u_char *) + roff, m1->m_len - (roff + hlen));
+               memmove(mtod(m1, u_char *) + roff, 
+                   mtod(m1, u_char *) + roff + hlen,
+                   m1->m_len - (roff + hlen));
                m1->m_len -= hlen;
                m->m_pkthdr.len -= hlen;
        }
@@ -910,7 +911,7 @@ esp_output(struct mbuf *m, struct tdb *t
        }
 
        /* Initialize ESP header. */
-       bcopy((caddr_t) &tdb->tdb_spi, mtod(mo, caddr_t) + roff,
+       memcpy(mtod(mo, caddr_t) + roff, (caddr_t) &tdb->tdb_spi,
            sizeof(u_int32_t));
        tdb->tdb_rpl++;
        replay = htonl((u_int32_t)tdb->tdb_rpl);
@@ -992,7 +993,7 @@ esp_output(struct mbuf *m, struct tdb *t
        tc->tc_spi = tdb->tdb_spi;
        tc->tc_proto = tdb->tdb_sproto;
        tc->tc_rdomain = tdb->tdb_rdomain;
-       memcpy(&tc->tc_dst, &tdb->tdb_dst, sizeof(union sockaddr_union));
+       tc->tc_dst = tdb->tdb_dst;
 
        /* Crypto operation descriptor. */
        crp->crp_ilen = m->m_pkthdr.len; /* Total input length. */
Index: ip_mroute.c
===================================================================
RCS file: /cvs/src/sys/netinet/ip_mroute.c,v
retrieving revision 1.112
diff -u -p -r1.112 ip_mroute.c
--- ip_mroute.c 17 Mar 2017 14:59:29 -0000      1.112
+++ ip_mroute.c 6 Apr 2017 15:21:28 -0000
@@ -951,10 +951,10 @@ add_mfc(struct socket *so, struct mbuf *
         */
        if (mrt_api_config & MRT_API_FLAGS_ALL) {
                struct mfcctl2 *mp2 = mtod(m, struct mfcctl2 *);
-               bcopy(mp2, (caddr_t)&mfcctl2, sizeof(*mp2));
+               memcpy((caddr_t)&mfcctl2, mp2, sizeof(*mp2));
        } else {
                struct mfcctl *mp = mtod(m, struct mfcctl *);
-               bcopy(mp, (caddr_t)&mfcctl2, sizeof(*mp));
+               memcpy((caddr_t)&mfcctl2, mp, sizeof(*mp));
                memset((caddr_t)&mfcctl2 + sizeof(struct mfcctl), 0,
                    sizeof(mfcctl2) - sizeof(struct mfcctl));
        }
@@ -988,7 +988,7 @@ del_mfc(struct socket *so, struct mbuf *
 
        mp = mtod(m, struct mfcctl *);
 
-       bcopy(mp, (caddr_t)&mfcctl2, sizeof(*mp));
+       memcpy((caddr_t)&mfcctl2, mp, sizeof(*mp));
        memset((caddr_t)&mfcctl2 + sizeof(struct mfcctl), 0,
            sizeof(mfcctl2) - sizeof(struct mfcctl));
 

Reply via email to