[ovs-dev] [PATCH 01/11] dp-packet: fix possible null pointer argument
blp at ovn.org
Mon Oct 30 19:25:22 UTC 2017
On Sat, Oct 28, 2017 at 10:31:48AM -0700, William Tu wrote:
> Clang reports possible null pointer argument to the memcpy src.
> This is due to at dp_packet_clone_data_with_headroom, the
> dp_packet *b might have a NULL base due to allocating a dp_packet
> with size = 0. Fix it by adding ovs_assert to satisfy clang.
> Signed-off-by: William Tu <u9012063 at gmail.com>
Thanks for working on this.
If 'old_base' might really be null, because of some path into the
function, then the most likely issue here is a very minor technical one:
the C specification requires that the pointer arguments to memcpy() be
nonnull even if the number of bytes to be copied is 0. Most actual
implementations of memcpy() do nothing in that case, which is the
expected result. In this case, in the situation where 'old_base' is
null, I guess that the number of bytes to be copied should be 0. That
means that, if this ever actually occurs, this patch will cause
dp_packet_copy__() to assert-fail instead of doing nothing. That is not
The right solution is probably to use nullable_memcpy() instead of
More information about the dev