'wc' can't be NULL there and if it can we'd already crash a few lines
before setting up vlan flags.

The check is misleading as it makes people to assume that wc can be
NULL.  And it makes Coverity think the same:

  CID 1596572: (#1 of 1): Dereference after null check (FORWARD_NULL)
  25. var_deref_op: Dereferencing null pointer ctx->wc.

  14. var_compare_op: Comparing ctx->wc to null implies that ctx->wc
      might be null

Remove the check.

Fixes: 3b1882261c8b ("ofproto-dpif-mirror: Add support for pre-selection 
filter.")
Signed-off-by: Ilya Maximets <i.maxim...@ovn.org>
---
 ofproto/ofproto-dpif-xlate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index be2c70721..02567a961 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -2315,7 +2315,7 @@ mirror_packet(struct xlate_ctx *ctx, struct xbundle 
*xbundle,
         }
 
         /* After the VLAN check, apply a flow mask if a filter is specified. */
-        if (ctx->wc && mc.filter_flow) {
+        if (mc.filter_flow) {
             flow_wildcards_union_with_minimask(ctx->wc, mc.filter_mask);
             if (!OVS_UNLIKELY(
                  miniflow_equal_flow_in_minimask(mc.filter_flow,
-- 
2.45.2

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to