should m_copyback possibly throw data away?

Gleb Smirnoff glebius at FreeBSD.org
Mon Apr 27 05:50:31 UTC 2015


On Fri, Apr 24, 2015 at 11:23:08AM -0700, John-Mark Gurney wrote:
J> John-Mark Gurney wrote this message on Fri, Apr 24, 2015 at 11:11 -0700:
J> > I would also be fine w/ documenting this behavior, though I'm sure
J> > it'd be surprising to many that you'd have to check to make sure your
J> > data was properly copied.
J> 
J> Should have reviewed the m_copyback function before sending this
J> email...
J> 
J> It gets worse..  If the m_get to extend it fails, there is no
J> notification that your data didn't get copyied into the mbuf.. and no
J> warning in the man page that this function is unsafe and may cause
J> data loss...
J> 
J> Comments?

My suggestion is:

1) make it return int
2) change first check to KASSERT
3) add wait parameter
4) while here change relic of c_caddr_t to const char *

Yes, this requires some time.

You can also look at OpenBSD/NetBSD.

-- 
Totus tuus, Glebius.


More information about the freebsd-net mailing list