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

Ben Pfaff blp at ovn.org
Mon Oct 30 19:15:42 UTC 2017


On Sat, Oct 28, 2017 at 10:31:49AM -0700, William Tu 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>
> ---
>  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);

I don't see how this makes sense.  in_dhcp_opt is a pointer plus a
nonzero constant.  That's only null if it wraps around.  I don't want to
"fix" this one.


More information about the dev mailing list