On Sat, Oct 28, 2017 at 10:31:54AM -0700, William Tu wrote:
> Clang reports possible null pointer passes to dst of memcmp, &nh->ip6_src.
> This is due to *nh comes from dp_packet_l3, and dp_packet_l3 might
> return NULL.  Fix it by adding ovs_assert check.
> 
> Signed-off-by: William Tu <u9012...@gmail.com>
> ---
>  lib/packets.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/packets.c b/lib/packets.c
> index 230a62553ff6..7b147bbfb880 100644
> --- a/lib/packets.c
> +++ b/lib/packets.c
> @@ -1191,6 +1191,7 @@ packet_set_ipv6(struct dp_packet *packet, const struct 
> in6_addr *src,
>  
>      rh_present = packet_rh_present(packet, &proto);
>  
> +    ovs_assert(&nh->ip6_src);
>      if (memcmp(&nh->ip6_src, src, sizeof(ovs_be32[4]))) {
>          packet_set_ipv6_addr(packet, proto, nh->ip6_src.be32, src, true);
>      }

In this case, Clang doesn't have enough context to understand the
situation.  packet_set_ipv6() is only called if the packet is already an
ipv6 packet, so the assertion is not helpful.
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to