From: Alexander Bluhm Subject: mbuf pulldown replace memmove with memcpy To: tech@openbsd.org Date: Thu, 29 Aug 2024 16:21:01 +0200 Hi, m_pulldown() copies memory between different mbufs. So they cannot overlap and memcpy() should be enough. ok? bluhm Index: kern/uipc_mbuf2.c =================================================================== RCS file: /data/mirror/openbsd/cvs/src/sys/kern/uipc_mbuf2.c,v diff -u -p -r1.46 uipc_mbuf2.c --- kern/uipc_mbuf2.c 29 Aug 2024 10:44:40 -0000 1.46 +++ kern/uipc_mbuf2.c 29 Aug 2024 14:04:56 -0000 @@ -171,7 +171,7 @@ m_pulldown(struct mbuf *m, int off, int 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 } /* 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);