From patchwork Tue Jul 16 12:47:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 1961084 X-Patchwork-Delegate: i.maximets@samsung.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WNf3k28Gdz1xqc for ; Tue, 16 Jul 2024 22:47:29 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id D6B8460A45; Tue, 16 Jul 2024 12:47:27 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id GIdkO2Do8v5r; Tue, 16 Jul 2024 12:47:27 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org DB4CA6074F Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id DB4CA6074F; Tue, 16 Jul 2024 12:47:26 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id ABCFAC0A97; Tue, 16 Jul 2024 12:47:26 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id ABF32C0A96 for ; Tue, 16 Jul 2024 12:47:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 9C24B608AC for ; Tue, 16 Jul 2024 12:47:25 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 9bHN_oz-vyGw for ; Tue, 16 Jul 2024 12:47:25 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2001:4b98:dc4:8::224; helo=relay4-d.mail.gandi.net; envelope-from=i.maximets@ovn.org; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org B54836074F Authentication-Results: smtp3.osuosl.org; dmarc=none (p=none dis=none) header.from=ovn.org DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org B54836074F Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by smtp3.osuosl.org (Postfix) with ESMTPS id B54836074F for ; Tue, 16 Jul 2024 12:47:24 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 873F2E000C; Tue, 16 Jul 2024 12:47:21 +0000 (UTC) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Tue, 16 Jul 2024 14:47:17 +0200 Message-ID: <20240716124718.455536-1-i.maximets@ovn.org> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-GND-Sasl: i.maximets@ovn.org Subject: [ovs-dev] [PATCH] ofproto-dpif-xlate: Remove misleading wc NULL check in packet mirror. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ilya Maximets Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" '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 Acked-by: Mike Pattrick --- 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,