DragonFly BSD
DragonFly submit List (threaded) for 2006-10
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: [PATCH] unneeded variable and simplification of uipc_mbuf.c


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 24 Oct 2006 08:22:05 -0700 (PDT)

:This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
:--------------enig749D12E3E0995E3F0C556A5B
: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 < ?
:
:Cheers,
:-- 
:         Thomas E. Spanjaard
:         tgen@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;
                        else
                                n->m_pkthdr.len = len;
                        copyhdr = 0;
                }
	
					-Matt
					Matthew Dillon 
					<dillon@xxxxxxxxxxxxx>



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]