From patchwork Tue Nov 5 11:09:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ales Musil X-Patchwork-Id: 2006818 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gBnlc9az; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (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 4XjQb1254Nz1xxN for ; Tue, 5 Nov 2024 22:09:33 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 88EC840560; Tue, 5 Nov 2024 11:09:28 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 8aB9fQ2H1BLT; Tue, 5 Nov 2024 11:09: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 smtp4.osuosl.org 5611A40566 Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gBnlc9az Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id 5611A40566; Tue, 5 Nov 2024 11:09:27 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 211D2C08A6; Tue, 5 Nov 2024 11:09:27 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3FE03C08A9 for ; Tue, 5 Nov 2024 11:09:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 0F516408EA for ; Tue, 5 Nov 2024 11:09:20 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id P8kjwoi1K9-m for ; Tue, 5 Nov 2024 11:09:18 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.133.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=amusil@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org 2BAFB40913 Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 2BAFB40913 Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gBnlc9az Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id 2BAFB40913 for ; Tue, 5 Nov 2024 11:09:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730804956; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l5EapxQVnomW9MzAG228l8BsqfWdRT0Q+q4gLygDr/4=; b=gBnlc9aztP2lVQaLhdROrNScNn5qUA55Pda/K/fI8x7/58bSCvbi454r3g7mGTugmIqQ79 08lDbR2IqUXT0TaclZpe9oZrdAc00Q5WVC3ISffPvYuHPg6HqAVkZFdjMy8iMc9+6fFyyq BdxBWhE0WCqXDInj99jYReOQYhej7yI= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-622-WRgS--KbOcKGNk4bS-QbAw-1; Tue, 05 Nov 2024 06:09:15 -0500 X-MC-Unique: WRgS--KbOcKGNk4bS-QbAw-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D2F231955F3C for ; Tue, 5 Nov 2024 11:09:14 +0000 (UTC) Received: from amusil.brq.redhat.com (unknown [10.43.17.32]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E20F21956086; Tue, 5 Nov 2024 11:09:13 +0000 (UTC) From: Ales Musil To: dev@openvswitch.org Date: Tue, 5 Nov 2024 12:09:10 +0100 Message-ID: <20241105110911.280756-2-amusil@redhat.com> In-Reply-To: <20241105110911.280756-1-amusil@redhat.com> References: <20241105110911.280756-1-amusil@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 1/2] mirror: Adjust pointer checks reported by coverity. 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: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" 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 --- 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; } From patchwork Tue Nov 5 11:09:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ales Musil X-Patchwork-Id: 2006820 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=JMUyi6c6; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (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 4XjQb23xm5z1xyR for ; Tue, 5 Nov 2024 22:09:34 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id EA2F1810A0; Tue, 5 Nov 2024 11:09:29 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 3fDYrLcvaPtn; Tue, 5 Nov 2024 11:09:29 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org CAC888102A Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=JMUyi6c6 Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id CAC888102A; Tue, 5 Nov 2024 11:09:28 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6859FC08A9; Tue, 5 Nov 2024 11:09:28 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3FB9DC08A8 for ; Tue, 5 Nov 2024 11:09:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 5D83C408E9 for ; Tue, 5 Nov 2024 11:09:20 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id HMfnhTv0wrJa for ; Tue, 5 Nov 2024 11:09:19 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=amusil@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org 63F30408C3 Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 63F30408C3 Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=JMUyi6c6 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id 63F30408C3 for ; Tue, 5 Nov 2024 11:09:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730804958; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w8XwcLES4P3ynVSb1r20IWdFRcooJOfFA9TCjV3j5WA=; b=JMUyi6c6mwT0+LcAR7AAqhyx8kw8r0LXPJOGssbCoxvCwhsoMSP1gGfHvMhLWzCygxTgGy EbixPYFRLKRWCX+nBayNhv1I9Qrhha/6ACrkFEEXlEzUr8f2TDg5kp+BkZAI1zskNbmHRs xrjSxH+Vf2eEGnXGJREFmle+JFF+4M0= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-677-dTEXI_32Mdije14WbtEmNQ-1; Tue, 05 Nov 2024 06:09:16 -0500 X-MC-Unique: dTEXI_32Mdije14WbtEmNQ-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 323821955EA9 for ; Tue, 5 Nov 2024 11:09:16 +0000 (UTC) Received: from amusil.brq.redhat.com (unknown [10.43.17.32]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4C0EE1956086; Tue, 5 Nov 2024 11:09:15 +0000 (UTC) From: Ales Musil To: dev@openvswitch.org Date: Tue, 5 Nov 2024 12:09:11 +0100 Message-ID: <20241105110911.280756-3-amusil@redhat.com> In-Reply-To: <20241105110911.280756-1-amusil@redhat.com> References: <20241105110911.280756-1-amusil@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 2/2] northd: Remove unnecessary pointer checks. 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: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The pointers in those checks are guaranteed to be non-NULL at that point in the code. There is no need to check them as pointed out by coverity. Signed-off-by: Ales Musil --- northd/northd.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/northd/northd.c b/northd/northd.c index 3037ce0b5..6087d170d 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -2397,7 +2397,7 @@ join_logical_ports(const struct sbrec_port_binding_table *sbrec_pb_table, /* If the router is multicast enabled then set relay on the switch * datapath. */ - if (peer->od && peer->od->mcast_info.rtr.relay) { + if (peer->od->mcast_info.rtr.relay) { op->od->mcast_info.sw.flood_relay = true; } @@ -3523,7 +3523,7 @@ ovn_lb_svc_create(struct ovsdb_idl_txn *ovnsb_txn, } const char *chassis_name = NULL; - if (op->sb && op->sb->chassis) { + if (op->sb->chassis) { chassis_name = op->sb->chassis->name; } @@ -9910,8 +9910,7 @@ build_lswitch_dhcp_options_and_response(struct ovn_port *op, return; } - if (op->od && op->od->nbs - && ls_dhcp_relay_port(op->od)) { + if (ls_dhcp_relay_port(op->od)) { /* Don't add the DHCP server flows if DHCP Relay is enabled on the * logical switch. */ return;