Skip to content

Commit

Permalink
ofproto-dpif-xlate: Remove misleading wc NULL check in packet mirror.
Browse files Browse the repository at this point in the history
'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: (openvswitch#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: 3b18822 ("ofproto-dpif-mirror: Add support for pre-selection filter.")
Signed-off-by: Ilya Maximets <[email protected]>
Signed-off-by: 0-day Robot <[email protected]>
  • Loading branch information
igsilya authored and ovsrobot committed Jul 16, 2024
1 parent 903aa8f commit b564a32
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ofproto/ofproto-dpif-xlate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b564a32

Please sign in to comment.