As pointed out by coverity, the code was structured
in a way that m->sb_mirror might have been NULL. At that point
in the code it's not possible. Add assert to emphasize that and
remove redundant check for m->ovs_mirror.

Signed-off-by: Ales Musil <[email protected]>
---
 controller/mirror.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/controller/mirror.c b/controller/mirror.c
index ebe455968..b557b96da 100644
--- a/controller/mirror.c
+++ b/controller/mirror.c
@@ -352,7 +352,8 @@ sync_ovn_mirror(struct ovn_mirror *m, struct ovsdb_idl_txn 
*ovs_idl_txn,
         return;
     }
 
-    if (m->sb_mirror && !m->ovs_mirror) {
+    ovs_assert(m->sb_mirror);
+    if (!m->ovs_mirror) {
         create_ovs_mirror(m, ovs_idl_txn, br_int, ovs_mirror_ports);
         if (!m->ovs_mirror) {
             return;
@@ -390,7 +391,7 @@ should_delete_ovs_mirror(struct ovn_mirror *m)
         return false;
     }
 
-    if (m->ovs_mirror && !m->sb_mirror) {
+    if (!m->sb_mirror) {
         return true;
     }
 
-- 
2.47.0

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

Reply via email to