[ovs-dev] [PATCH 02/11] ovn-controller: Fix possible null pointer in memcmp.

Mark Michelson mmichels at redhat.com
Mon Oct 30 14:26:36 UTC 2017


This looks fine to me. Usually I don't like assertions based on contents of
incoming packets. However, in this case, ovn-northd has set up the logical
flow so that only UDP packets can reach here.

On Sat, Oct 28, 2017 at 12:34 PM William Tu <u9012063 at gmail.com> wrote:

> Clang reports possible null pointer in_dhcp_opt passing to memcmp.
> This might due to dp_packet_get_udp_payload retuning null.  Fix it
> by adding ovs_assert.
>
> Signed-off-by: William Tu <u9012063 at gmail.com>
>
Acked-by: Mark Michelson<mmichels at redhat.com>

> ---
>  ovn/controller/pinctrl.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c
> index 469a35586b8a..3fdd01182a52 100644
> --- a/ovn/controller/pinctrl.c
> +++ b/ovn/controller/pinctrl.c
> @@ -270,6 +270,7 @@ pinctrl_handle_put_dhcp_opts(
>          sizeof (struct dhcp_header);
>
>      ovs_be32 magic_cookie = htonl(DHCP_MAGIC_COOKIE);
> +    ovs_assert(in_dhcp_opt);
>      if (memcmp(in_dhcp_opt, &magic_cookie, sizeof(ovs_be32))) {
>          static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
>          VLOG_WARN_RL(&rl, "DHCP magic cookie not present in the DHCP
> packet");
> --
> 2.7.4
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>


More information about the dev mailing list