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

William Tu u9012063 at gmail.com
Sat Oct 28 17:31:49 UTC 2017


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);
     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



More information about the dev mailing list