From: bluhm Date: Thu, 29 Aug 2024 16:42:30 +0000 (+0000) Subject: In m_pulldown() replace memmove() with memcpy(). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=34319c5024f9fbb3da768aba3e51dac1a1d276fa;p=openbsd In m_pulldown() replace memmove() with memcpy(). The memmove() in m_pulldown() copied memory between different mbufs. So data cannot overlap and memcpy() is enough. OK claudio@ deraadt@ --- diff --git a/sys/kern/uipc_mbuf2.c b/sys/kern/uipc_mbuf2.c index 6a4bdca56ab..a51e3f02911 100644 --- a/sys/kern/uipc_mbuf2.c +++ b/sys/kern/uipc_mbuf2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_mbuf2.c,v 1.46 2024/08/29 10:44:40 bluhm Exp $ */ +/* $OpenBSD: uipc_mbuf2.c,v 1.47 2024/08/29 16:42:30 bluhm Exp $ */ /* $KAME: uipc_mbuf2.c,v 1.29 2001/02/14 13:42:10 itojun Exp $ */ /* $NetBSD: uipc_mbuf.c,v 1.40 1999/04/01 00:23:25 thorpej Exp $ */ @@ -171,7 +171,7 @@ m_pulldown(struct mbuf *m, int off, int len, int *offp) n->m_next->m_data -= hlen; n->m_next->m_len += hlen; counters_inc(mbstat, MBSTAT_PULLDOWN_COPY); - memmove(mtod(n->m_next, caddr_t), mtod(n, caddr_t) + off, hlen); + memcpy(mtod(n->m_next, caddr_t), mtod(n, caddr_t) + off, hlen); n->m_len -= hlen; n = n->m_next; off = 0; @@ -201,7 +201,7 @@ m_pulldown(struct mbuf *m, int off, int len, int *offp) } /* get hlen from into */ o->m_len = hlen; - memmove(mtod(o, caddr_t), mtod(n, caddr_t) + off, hlen); + memcpy(mtod(o, caddr_t), mtod(n, caddr_t) + off, hlen); n->m_len -= hlen; /* get tlen from m_next, 0> into */ m_copydata(n->m_next, 0, tlen, mtod(o, caddr_t) + o->m_len);