Subject: Re: m_copyback patch.
To: None <tech-kern@NetBSD.ORG, email@example.com>
From: Wolfgang Solfrank <firstname.lastname@example.org>
Date: 01/12/1998 13:18:08
> Included below is a patch to help m_copyback() be less wasteful when
> copying data back into mbuf's. Currently, (for example), if an mbuf
> is allocated with 10 bytes of data (m_len == 10), and m_copyback()
> is called to write 11 bytes into the mbuf, it will write the 10 in
> and then attempt to allocate another mbuf to put the extra byte in.
> This patch is aimed to address this problem by extending the size
> of the mbuf upto MLEN/MHLEN (max) as appropriate.
> Does anyone have any problems with it being committed ?
This will not work, at least not as done by your patch :-(.
The problem is that you cannot be sure that the mbuf does have MLEN/MHLEN
at the address pointer to by mh_data (and thus returned by the mtod macro).
The mh_data pointer might have been incremented beyond its initial value.
Hell, it even might have been setup with an offset to allow later insertion
of a header in front of the data placed into it initially.
ws@TooLs.DE (Wolfgang Solfrank, TooLs GmbH) +49-228-985800