[PATCH] unneeded variable and simplification of uipc_mbuf.c

Matthew Dillon dillon at apollo.backplane.com
Tue Oct 24 08:24:50 PDT 2006

:This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
:Content-Type: text/plain; charset=ISO-8859-1; format=flowed
:Content-Transfer-Encoding: 7bit
:tbert wrote:
:> -			if (len == M_COPYALL)
:> -				n->m_pkthdr.len -= off0;
:> -			else
:> +			if (len != M_COPYALL)
:> off0 is unneeded, and the subtraction of a known 0 value is
:> removed.
:Are you sure m_copym is never called with an off0 of > 0 < ?
:         Thomas E. Spanjaard
:         tgen at xxxxxxxxxxxxx

    I see one case where it can be, a call to sctp_m_copym() 
    from sctp_add_cookie() looks like it could potentially pass
    a non-zero offset in combination with M_COPYALL.

    The issue here isn't so much whether the case occurs or not,
    but whether m_copym should generically allow the case or not.
    If not, then an assertion would be appropriate.  We definitely
    do not want to simply ignore the variable, though.

    This bit of code in the originanl m_copym looks wrong, or at 
    least confusing enough that I don't understand what it is trying to
    do in the len != M_COPYALL case.

                if (copyhdr) {
                        if (!m_dup_pkthdr(n, m, wait))
                                goto nospace;
                        if (len == M_COPYALL)
                                n->m_pkthdr.len -= off0;
                                n->m_pkthdr.len = len;
                        copyhdr = 0;
					Matthew Dillon 
					<dillon at xxxxxxxxxxxxx>

More information about the Submit mailing list