On Thu, Nov 17, 2016 at 03:56:57PM -0800, Gleb Smirnoff wrote: T> On Thu, Nov 17, 2016 at 10:44:12PM +0800, Sepherosa Ziehau wrote: T> S> On Thu, Nov 17, 2016 at 10:03 PM, Bjoern A. Zeeb <b...@freebsd.org> wrote: T> S> > Author: bz T> S> > Date: Thu Nov 17 14:03:44 2016 T> S> > New Revision: 308748 T> S> > URL: https://svnweb.freebsd.org/changeset/base/308748 T> S> > T> S> > Log: T> S> > Writing out the L2TP control packet requires 12 bytes of T> S> > contiguous memory but in one path we did not always guarantee this, T> S> > thus do a m_pullup() there. T> S> > T> S> > PR: 214385 T> S> > Submitted by: Joe Jones (joeknockando googlemail.com) T> S> > MFC after: 3 days T> S> > T> S> > Modified: T> S> > head/sys/netgraph/ng_l2tp.c T> S> > T> S> > Modified: head/sys/netgraph/ng_l2tp.c T> S> > ============================================================================== T> S> > --- head/sys/netgraph/ng_l2tp.c Thu Nov 17 11:48:07 2016 (r308747) T> S> > +++ head/sys/netgraph/ng_l2tp.c Thu Nov 17 14:03:44 2016 (r308748) T> S> > @@ -1544,6 +1544,16 @@ ng_l2tp_xmit_ctrl(priv_p priv, struct mb T> S> > priv->stats.memoryFailures++; T> S> > return (ENOBUFS); T> S> > } T> S> > + T> S> > + /* T> S> > + * The below requires 12 contiguous bytes for the L2TP header T> S> > + * to be written into. T> S> > + */ T> S> > + m = m_pullup(m, 12); T> S> > + if (m == NULL) { T> S> > + priv->stats.memoryFailures++; T> S> > + return (ENOBUFS); T> S> > + } T> S> T> S> Would it be better that we do a (m->m_len < 12) test before doing the T> S> m_pullup()? T> T> Yes, and a line like: T> T> if (m->m_len < 12 && (m = m_pullup(m, 12)) == NULL) T> T> will also match the style of the rest of the code in the function.
I think the whole block can be shortened to: - prepend 10 - pullup 12 - read session_id at offset 10 The first pullup can be removed. -- Totus tuus, Glebius. _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"