Until now, the code here assumed that a "distributed-port" key existed,
and dereferenced a null pointer if it did not.  This commit avoids that
problem.

Found by Coverity.

Reported-at: 
https://scan3.coverity.com/reports.htm#v16889/p10449/fileInstanceId=14763078&defectInstanceId=4305288&mergedDefectId=179857
Signed-off-by: Ben Pfaff <[email protected]>
---
 ovn/controller/physical.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ovn/controller/physical.c b/ovn/controller/physical.c
index 532c7252e1ea..4e7a08798642 100644
--- a/ovn/controller/physical.c
+++ b/ovn/controller/physical.c
@@ -370,8 +370,8 @@ consider_port_binding(enum mf_field_id mff_ovn_geneve,
         match_set_metadata(&match, htonll(dp_key));
         match_set_reg(&match, MFF_LOG_OUTPORT - MFF_REG0, port_key);
 
-        const char *distributed_port = smap_get(&binding->options,
-                                                "distributed-port");
+        const char *distributed_port = smap_get_def(&binding->options,
+                                                    "distributed-port", "");
         const struct sbrec_port_binding *distributed_binding
             = lport_lookup_by_name(lports, distributed_port);
 
-- 
2.10.2

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to