[ovs-dev] [PATCH 2/2] ofpbuf: Fix setting of 'msg' in ofpbuf_clone_with_headroom()

Joe Stringer joe at ovn.org
Sat Mar 5 02:55:31 UTC 2016


(Responding to both patches here as I'm having email reception problems)

On 3 March 2016 at 15:12, Jarno Rajahalme <jarno at ovn.org> wrote:
> Commit 38876d31 fixed setting 'msg' when resizing an ofpbuf, but
> failed to fix the same issue in ofpbuf_clone_with_headroom().  Without
> this fix the newly cloned ofpbuf's 'msg', if non-NULL, will point to
> the buffer of the original ofpbuf.
>
> Signed-off-by: Jarno Rajahalme <jarno at ovn.org>

In the first patch, there are two changes: Adjusting the header offset
calculation, and some nice cosmetic improvements. It's not entirely
straightforward to see, but I think that if the ptrdiff_t is unsigned
and the new buffer is actually allocated earlier in memory than the
old buffer, then the offset is really wrong. This change should stand
alone from cosmetic fixes. That said, I completely agree with those
changes.

This second patch LGTM.

Acked-by: Joe Stringer <joe at ovn.org>



More information about the dev mailing list