Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Apr 2015 08:50:20 +0300
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        John-Mark Gurney <jmg@funkthat.com>
Cc:        freebsd-net@FreeBSD.org, Poul-Henning Kamp <phk@phk.freebsd.dk>
Subject:   Re: should m_copyback possibly throw data away?
Message-ID:  <20150427055020.GC883@FreeBSD.org>
In-Reply-To: <20150424182308.GK37063@funkthat.com>
References:  <20150424181158.GJ37063@funkthat.com> <20150424182308.GK37063@funkthat.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150427055020.GC883>