From: dhill Date: Wed, 5 Apr 2017 22:27:03 +0000 (+0000) Subject: Replace 2 bcopy()'s with a simple assignment as both variables are X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2d0f50edae2e365c2fce5d6b10eaffc626da0a66;p=openbsd Replace 2 bcopy()'s with a simple assignment as both variables are properly aligned malloc(9)d data and sockaddr_union fields. While here, convert the remaining bcopy() to memmove(). with and ok @bluhm --- diff --git a/sys/netinet/ip_ipcomp.c b/sys/netinet/ip_ipcomp.c index 75f9f0d6aa7..163f4d00002 100644 --- a/sys/netinet/ip_ipcomp.c +++ b/sys/netinet/ip_ipcomp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipcomp.c,v 1.55 2017/02/17 14:49:03 bluhm Exp $ */ +/* $OpenBSD: ip_ipcomp.c,v 1.56 2017/04/05 22:27:03 dhill Exp $ */ /* * Copyright (c) 2001 Jean-Jacques Bernard-Gundol (jj@wabbitt.org) @@ -181,7 +181,7 @@ ipcomp_input(struct mbuf *m, struct tdb *tdb, int skip, int protoff) tc->tc_spi = tdb->tdb_spi; tc->tc_proto = IPPROTO_IPCOMP; tc->tc_rdomain = tdb->tdb_rdomain; - bcopy(&tdb->tdb_dst, &tc->tc_dst, sizeof(union sockaddr_union)); + tc->tc_dst = tdb->tdb_dst; return crypto_dispatch(crp); } @@ -317,8 +317,8 @@ ipcomp_input_cb(struct cryptop *crp) /* Finally, let's relink */ m1->m_next = mo; } else { - bcopy(mtod(m1, u_char *) + roff + hlen, - mtod(m1, u_char *) + roff, + 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; @@ -501,7 +501,7 @@ ipcomp_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, tc->tc_proto = tdb->tdb_sproto; tc->tc_skip = skip; tc->tc_rdomain = tdb->tdb_rdomain; - bcopy(&tdb->tdb_dst, &tc->tc_dst, sizeof(union sockaddr_union)); + tc->tc_dst = tdb->tdb_dst; /* Crypto operation descriptor */ crp->crp_ilen = m->m_pkthdr.len; /* Total input length */