[ovs-dev] [PATCH 06/11] packets: Fix possible null pointer argument to memmove.
Ben Pfaff
blp at ovn.org
Mon Oct 30 19:28:53 UTC 2017
On Sat, Oct 28, 2017 at 10:31:53AM -0700, William Tu wrote:
> Clang reports possible null pointer to memmove due to
> dp_packet_data might retun null. Fix it by adding
> ovs_assert check.
>
> Signed-off-by: William Tu <u9012063 at gmail.com>
> ---
> lib/packets.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/lib/packets.c b/lib/packets.c
> index 74d87eda89e1..230a62553ff6 100644
> --- a/lib/packets.c
> +++ b/lib/packets.c
> @@ -397,6 +397,7 @@ pop_mpls(struct dp_packet *packet, ovs_be16 ethtype)
> dp_packet_set_l2_5(packet, NULL);
> }
> /* Shift the l2 header forward. */
> + ovs_assert(dp_packet_data(packet));
> memmove((char*)dp_packet_data(packet) + MPLS_HLEN, dp_packet_data(packet), len);
> dp_packet_resize_l2_5(packet, -MPLS_HLEN);
> }
Clang is just wrong here. The packet has to be nonnull because it is an
MPLS packet.
More information about the dev
mailing list