Hello -

Here are a few bcopy -> memcpy conversions for buffers that do not
overlap.

Index: sys/netinet6/ip6_forward.c
===================================================================
RCS file: /cvs/src/sys/netinet6/ip6_forward.c,v
retrieving revision 1.86
diff -u -p -r1.86 ip6_forward.c
--- sys/netinet6/ip6_forward.c  2 Nov 2015 07:22:28 -0000       1.86
+++ sys/netinet6/ip6_forward.c  2 Dec 2015 17:20:27 -0000
@@ -206,7 +206,7 @@ reroute:
                }
 
                /* We need to do IPsec */
-               bcopy(&tdb->tdb_dst, &sdst, sizeof(sdst));
+               memcpy(&sdst, &tdb->tdb_dst, sizeof(sdst));
                sspi = tdb->tdb_spi;
                sproto = tdb->tdb_sproto;
        }
Index: sys/netinet6/ip6_input.c
===================================================================
RCS file: /cvs/src/sys/netinet6/ip6_input.c,v
retrieving revision 1.151
diff -u -p -r1.151 ip6_input.c
--- sys/netinet6/ip6_input.c    11 Nov 2015 10:23:23 -0000      1.151
+++ sys/netinet6/ip6_input.c    2 Dec 2015 17:20:28 -0000
@@ -804,7 +804,7 @@ ip6_process_hopopts(struct mbuf *m, u_in
                                return (-1);
                        }
                        optlen = IP6OPT_RTALERT_LEN;
-                       bcopy((caddr_t)(opt + 2), (caddr_t)&rtalert_val, 2);
+                       memcpy(&rtalert_val, opt + 2, sizeof(rtalert_val));
                        *rtalertp = ntohs(rtalert_val);
                        break;
                case IP6OPT_JUMBO:
@@ -837,9 +837,9 @@ ip6_process_hopopts(struct mbuf *m, u_in
 
                        /*
                         * We may see jumbolen in unaligned location, so
-                        * we'd need to perform bcopy().
+                        * we'd need to perform memcpy().
                         */
-                       bcopy(opt + 2, &jumboplen, sizeof(jumboplen));
+                       memcpy(&jumboplen, opt + 2, sizeof(jumboplen));
                        jumboplen = (u_int32_t)htonl(jumboplen);
 
 #if 1
@@ -962,7 +962,7 @@ ip6_savecontrol(struct inpcb *in6p, stru
        /* RFC 2292 sec. 5 */
        if ((in6p->inp_flags & IN6P_PKTINFO) != 0) {
                struct in6_pktinfo pi6;
-               bcopy(&ip6->ip6_dst, &pi6.ipi6_addr, sizeof(struct in6_addr));
+               memcpy(&pi6.ipi6_addr, &ip6->ip6_dst, sizeof(struct in6_addr));
                if (IN6_IS_SCOPE_EMBED(&pi6.ipi6_addr))
                        pi6.ipi6_addr.s6_addr16[1] = 0;
                pi6.ipi6_ifindex = m ? m->m_pkthdr.ph_ifidx : 0;
Index: sys/netinet6/ip6_output.c
===================================================================
RCS file: /cvs/src/sys/netinet6/ip6_output.c,v
retrieving revision 1.201
diff -u -p -r1.201 ip6_output.c
--- sys/netinet6/ip6_output.c   2 Dec 2015 13:29:26 -0000       1.201
+++ sys/netinet6/ip6_output.c   2 Dec 2015 17:20:28 -0000
@@ -2015,7 +2015,7 @@ do {\
                dst->type = malloc(hlen, M_IP6OPT, canwait);\
                if (dst->type == NULL && canwait == M_NOWAIT)\
                        goto bad;\
-               bcopy(src->type, dst->type, hlen);\
+               memcpy(dst->type, src->type, hlen);\
        }\
 } while (/*CONSTCOND*/ 0)
 
Index: sys/netinet6/raw_ip6.c
===================================================================
RCS file: /cvs/src/sys/netinet6/raw_ip6.c,v
retrieving revision 1.87
diff -u -p -r1.87 raw_ip6.c
--- sys/netinet6/raw_ip6.c      24 Nov 2015 13:37:16 -0000      1.87
+++ sys/netinet6/raw_ip6.c      2 Dec 2015 17:20:28 -0000
@@ -756,7 +756,7 @@ rip6_usrreq(struct socket *so, int req, 
                        bzero(&tmp, sizeof(tmp));
                        tmp.sin6_family = AF_INET6;
                        tmp.sin6_len = sizeof(struct sockaddr_in6);
-                       bcopy(&in6p->inp_faddr6, &tmp.sin6_addr,
+                       memcpy(&tmp.sin6_addr, &in6p->inp_faddr6,
                            sizeof(struct in6_addr));
                        dst = &tmp;
                } else {


Reply via email to