From b564a3275620f143d7883c67f7fdeae4788d8a09 Mon Sep 17 00:00:00 2001 From: Ilya Maximets Date: Tue, 16 Jul 2024 14:47:17 +0200 Subject: [PATCH] ofproto-dpif-xlate: Remove misleading wc NULL check in packet mirror. '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 Signed-off-by: 0-day Robot --- 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 be2c707215f..02567a961d5 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,