git: be79f30d6c3e - main - m_dup: Handle unmapped mbufs as an input mbuf.

John Baldwin jhb at FreeBSD.org
Mon Jul 26 21:10:46 UTC 2021


The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=be79f30d6c3e353856d4f82227b270abc26be702

commit be79f30d6c3e353856d4f82227b270abc26be702
Author:     John Baldwin <jhb at FreeBSD.org>
AuthorDate: 2021-07-26 21:03:28 +0000
Commit:     John Baldwin <jhb at FreeBSD.org>
CommitDate: 2021-07-26 21:09:16 +0000

    m_dup: Handle unmapped mbufs as an input mbuf.
    
    Use m_copydata() instead of a direct bcopy() when copying data out of
    a source mbuf into a newly-allocated mbuf.
    
    PR:           256610
    Reported by:  Niels Bakker <niels=freebsd at bakker.net>
    Reviewed by:  markj
    MFC after:    2 weeks
---
 sys/kern/uipc_mbuf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index 74c8ef62eb8d..0f1a0c5e4e0c 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -729,7 +729,7 @@ m_dup(const struct mbuf *m, int how)
 		while (n->m_len < nsize && m != NULL) {
 			int chunk = min(nsize - n->m_len, m->m_len - moff);
 
-			bcopy(m->m_data + moff, n->m_data + n->m_len, chunk);
+			m_copydata(m, moff, chunk, n->m_data + n->m_len);
 			moff += chunk;
 			n->m_len += chunk;
 			remain -= chunk;


More information about the dev-commits-src-all mailing list