From patchwork Wed Jun 26 13:30:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ales Musil X-Patchwork-Id: 1952631 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=QXYq1Oqu; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (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 4W8MyV5RRLz20X1 for ; Wed, 26 Jun 2024 23:30:26 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 8FAA141193; Wed, 26 Jun 2024 13:30:24 +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 C4ZPZpVdlEEA; Wed, 26 Jun 2024 13:30:23 +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 smtp2.osuosl.org C8A454114E Authentication-Results: smtp2.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=QXYq1Oqu Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id C8A454114E; Wed, 26 Jun 2024 13:30:22 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 36DC3C0035; Wed, 26 Jun 2024 13:30:21 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0B0F6C002A for ; Wed, 26 Jun 2024 13:30:19 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 6CE7D40C9F for ; Wed, 26 Jun 2024 13:30:18 +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 4Sp6tIeyzBI0 for ; Wed, 26 Jun 2024 13:30:16 +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 smtp4.osuosl.org 32BC340C07 Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 32BC340C07 Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=QXYq1Oqu Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id 32BC340C07 for ; Wed, 26 Jun 2024 13:30:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719408614; 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=PeJf7RHRIzUaIhJ3MYqcbQO8MuRVooV4/f9JT61vwPk=; b=QXYq1Oqu4ySA+w6l6crbTbu79wZjBvEInlSi0eh8tv0DtEPiknLJcx9KSQa/ot8yXELLgy dl21u+vYOQc5RRfxU30LPLpREduWAZOEoh3I2dYd4v5GrdvgQ3Te/01f6qFtmvYrBNMCcH PLLRkbu+2pIHPV5rPww7cz1bh494o1U= Received: from mx-prod-mc-05.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-489-iIeIKJNgMyanAFUSq5A7Xg-1; Wed, 26 Jun 2024 09:30:12 -0400 X-MC-Unique: iIeIKJNgMyanAFUSq5A7Xg-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1B3F51956083 for ; Wed, 26 Jun 2024 13:30:12 +0000 (UTC) Received: from amusil.brq.redhat.com (unknown [10.43.17.32]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BD6E5300022A; Wed, 26 Jun 2024 13:30:10 +0000 (UTC) From: Ales Musil To: dev@openvswitch.org Date: Wed, 26 Jun 2024 15:30:04 +0200 Message-ID: <20240626133007.694177-2-amusil@redhat.com> In-Reply-To: <20240626133007.694177-1-amusil@redhat.com> References: <20240626133007.694177-1-amusil@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 1/4] treewide: Remove dead code. 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: dceara@redhat.com Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The coverity static analysis identified a few places with extra checks and dead code that cannot be logically reached. Remove this dead code from the codebase. Signed-off-by: Ales Musil --- controller/binding.c | 2 +- controller/lflow.c | 5 +---- controller/lflow.h | 3 +-- controller/ovn-controller.c | 3 +-- controller/pinctrl.c | 8 +------- lib/inc-proc-eng.c | 8 ++------ lib/lex.c | 1 - northd/test-ipam.c | 4 ---- 8 files changed, 7 insertions(+), 27 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index f467caf07..b7e7f4874 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -401,7 +401,7 @@ configure_qos(const struct sbrec_port_binding *pb, q->queue_id = queue_id; } free(q->network); - q->network = network ? xstrdup(network) : NULL; + q->network = xstrdup(network); q->min_rate = min_rate; q->max_rate = max_rate; q->burst = burst; diff --git a/controller/lflow.c b/controller/lflow.c index 1e05665a1..b4c379044 100644 --- a/controller/lflow.c +++ b/controller/lflow.c @@ -2388,15 +2388,12 @@ lflow_handle_changed_lbs(struct lflow_ctx_in *l_ctx_in, struct lflow_ctx_out *l_ctx_out, const struct uuidset *deleted_lbs, const struct uuidset *updated_lbs, - const struct uuidset *new_lbs, - const struct hmap *old_lbs) + const struct uuidset *new_lbs) { const struct ovn_controller_lb *lb; struct uuidset_node *uuid_node; UUIDSET_FOR_EACH (uuid_node, deleted_lbs) { - lb = ovn_controller_lb_find(old_lbs, &uuid_node->uuid); - VLOG_DBG("Remove hairpin flows for deleted load balancer "UUID_FMT, UUID_ARGS(&uuid_node->uuid)); ofctrl_remove_flows(l_ctx_out->flow_table, &uuid_node->uuid); diff --git a/controller/lflow.h b/controller/lflow.h index 1d20cae35..7c947a909 100644 --- a/controller/lflow.h +++ b/controller/lflow.h @@ -178,8 +178,7 @@ bool lflow_handle_changed_lbs(struct lflow_ctx_in *l_ctx_in, struct lflow_ctx_out *l_ctx_out, const struct uuidset *deleted_lbs, const struct uuidset *updated_lbs, - const struct uuidset *new_lbs, - const struct hmap *old_lbs); + const struct uuidset *new_lbs); bool lflow_handle_changed_fdbs(struct lflow_ctx_in *, struct lflow_ctx_out *); void lflow_destroy(void); diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index ed95818a0..0cbf6df58 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -4589,8 +4589,7 @@ lflow_output_lb_data_handler(struct engine_node *node, void *data) bool handled = lflow_handle_changed_lbs(&l_ctx_in, &l_ctx_out, &lb_data->deleted, &lb_data->updated, - &lb_data->new, - &lb_data->old_lbs); + &lb_data->new); engine_set_node_state(node, EN_UPDATED); return handled; diff --git a/controller/pinctrl.c b/controller/pinctrl.c index 8adec6179..f1f4cec58 100644 --- a/controller/pinctrl.c +++ b/controller/pinctrl.c @@ -4507,17 +4507,11 @@ ipv6_ra_send(struct rconn *swconn, struct ipv6_ra_state *ra) uint64_t packet_stub[128 / 8]; struct dp_packet packet; - uint16_t router_lt = IPV6_ND_RA_LIFETIME; - - if (!router_lt) { - /* Reset PRF to MEDIUM if router lifetime is not set */ - ra->config->mo_flags &= ~IPV6_ND_RA_OPT_PRF_LOW; - } dp_packet_use_stub(&packet, packet_stub, sizeof packet_stub); compose_nd_ra(&packet, ra->config->eth_src, ra->config->eth_dst, &ra->config->ipv6_src, &ra->config->ipv6_dst, - 255, ra->config->mo_flags, htons(router_lt), 0, 0, + 255, ra->config->mo_flags, htons(IPV6_ND_RA_LIFETIME), 0, 0, ra->config->mtu); for (int i = 0; i < ra->config->prefixes.n_ipv6_addrs; i++) { diff --git a/lib/inc-proc-eng.c b/lib/inc-proc-eng.c index 4b379229e..a01440bb4 100644 --- a/lib/inc-proc-eng.c +++ b/lib/inc-proc-eng.c @@ -131,7 +131,6 @@ engine_dump_stats(struct unixctl_conn *conn, int argc, const char *dump_eng_node_name = (argc > 1 ? argv[1] : NULL); const char *dump_stat_type = (argc > 2 ? argv[2] : NULL); - bool success = true; for (size_t i = 0; i < engine_n_nodes; i++) { struct engine_node *node = engine_nodes[i]; @@ -163,11 +162,8 @@ engine_dump_stats(struct unixctl_conn *conn, int argc, break; } } - if (success) { - unixctl_command_reply(conn, ds_cstr(&dump)); - } else { - unixctl_command_reply_error(conn, "Invalid stat type"); - } + + unixctl_command_reply(conn, ds_cstr(&dump)); ds_destroy(&dump); } diff --git a/lib/lex.c b/lib/lex.c index a8b9812bb..06c40f7ae 100644 --- a/lib/lex.c +++ b/lib/lex.c @@ -644,7 +644,6 @@ next: p++; } } - goto next; } else { lex_error(token, "`/' is only valid as part of `//' or `/*'."); diff --git a/northd/test-ipam.c b/northd/test-ipam.c index 62a4fd399..c449599e3 100644 --- a/northd/test-ipam.c +++ b/northd/test-ipam.c @@ -38,7 +38,6 @@ test_ipam_get_unused_ip(struct ovs_cmdl_context *ctx) } init_ipam_info(&info, &config, "Unused IP test"); - bool fail = false; struct ds output = DS_EMPTY_INITIALIZER; struct ds err = DS_EMPTY_INITIALIZER; for (size_t i = 0; i < num_ips; i++) { @@ -50,9 +49,6 @@ test_ipam_get_unused_ip(struct ovs_cmdl_context *ctx) } printf("%s", ds_cstr(&output)); - if (fail) { - fprintf(stderr, "%s", ds_cstr(&err)); - } smap_destroy(&config); destroy_ipam_info(&info); From patchwork Wed Jun 26 13:30:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ales Musil X-Patchwork-Id: 1952630 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=LD+vfipt; 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 4W8MyQ71tNz20X1 for ; Wed, 26 Jun 2024 23:30:22 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 5215A81F96; Wed, 26 Jun 2024 13:30:21 +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 3KOk7XQT7YFY; Wed, 26 Jun 2024 13:30:20 +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 smtp1.osuosl.org 5245D81BF4 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=LD+vfipt Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id 5245D81BF4; Wed, 26 Jun 2024 13:30:20 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 25925C002B; Wed, 26 Jun 2024 13:30:20 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8181FC0035 for ; Wed, 26 Jun 2024 13:30:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 675A240C9B for ; Wed, 26 Jun 2024 13:30:18 +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 fd1T9qJqMicl for ; Wed, 26 Jun 2024 13:30:17 +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 smtp4.osuosl.org 6514640C27 Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 6514640C27 Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=LD+vfipt Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id 6514640C27 for ; Wed, 26 Jun 2024 13:30:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719408615; 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=VOHgqwMrOxz+5sQS5yfmB17ycEaMN/iY5uAvzMRRxIs=; b=LD+vfipta54ONck6JujhyneXEUD9PPos9KQy5b0+OsrV1nAX5G1+gMqBW5yEJlwTYniio0 V+IWjAM4q7OzoKsF2lblOnCbOUl1MyZoqUSOnv4knWfQtiEZTcfoNvsy8pdzlOE4FHqV5E zqhcFGNUH+Dev2uRErsdm1HxAcQrUtw= Received: from mx-prod-mc-05.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-638-eVmISSFDMj2wL1_pwQ6uDg-1; Wed, 26 Jun 2024 09:30:14 -0400 X-MC-Unique: eVmISSFDMj2wL1_pwQ6uDg-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 996B91956086 for ; Wed, 26 Jun 2024 13:30:13 +0000 (UTC) Received: from amusil.brq.redhat.com (unknown [10.43.17.32]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 57F943000225; Wed, 26 Jun 2024 13:30:12 +0000 (UTC) From: Ales Musil To: dev@openvswitch.org Date: Wed, 26 Jun 2024 15:30:05 +0200 Message-ID: <20240626133007.694177-3-amusil@redhat.com> In-Reply-To: <20240626133007.694177-1-amusil@redhat.com> References: <20240626133007.694177-1-amusil@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 2/4] northd: Fix potential overflow 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: dceara@redhat.com Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The threshold computation could overflow during the conversion to ms. Make sure that the arithmetic is done on 64-bit value instead of 32-bit one. Signed-off-by: Ales Musil --- northd/aging.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/northd/aging.c b/northd/aging.c index 9685044e7..e095f29b2 100644 --- a/northd/aging.c +++ b/northd/aging.c @@ -330,7 +330,8 @@ aging_context_handle_timestamp(struct aging_context *ctx, int64_t timestamp, } ovs_assert(ctx->threshold); - uint64_t threshold = 1000 * find_threshold_for_ip(ip, ctx->threshold); + uint64_t threshold = + 1000 * (uint64_t) find_threshold_for_ip(ip, ctx->threshold); if (!threshold) { return false; From patchwork Wed Jun 26 13:30:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ales Musil X-Patchwork-Id: 1952632 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=aNaKHPuh; 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 4W8MyW6Gvkz20X1 for ; Wed, 26 Jun 2024 23:30:27 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 51E7E8206A; Wed, 26 Jun 2024 13:30:26 +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 vEUBN1AIWOZd; Wed, 26 Jun 2024 13:30:24 +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 8677681D5F 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=aNaKHPuh Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 8677681D5F; Wed, 26 Jun 2024 13:30:23 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 48195C0925; Wed, 26 Jun 2024 13:30:23 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4A393C0035 for ; Wed, 26 Jun 2024 13:30:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 060EC81BF4 for ; Wed, 26 Jun 2024 13:30:20 +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 zjD5jYLQRt7O for ; Wed, 26 Jun 2024 13:30: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 smtp1.osuosl.org 38FD781A5F Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 38FD781A5F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id 38FD781A5F for ; Wed, 26 Jun 2024 13:30:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719408617; 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=ItYxYkO55tb/X3y0p59BkHtTATcr/5pl1j5EPbP4Vak=; b=aNaKHPuh88WAE9uFEof2mSESrhgK6fcyfpA1mBIf1E0U6fi9uuqeTqYpWLGLxhULpuZcvF aU1w3PLwAxQ0PBmU3gDTa58sxV1nra4ZhNr33UIlvqEMZFfRPA6LDoS5o2Q/E7Z07to4a8 OmrAXJzY7Ptnx/zgtrO3UCy8zvvIPSE= 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-611-CPZzB4LfOUWvDD7GE_l0mg-1; Wed, 26 Jun 2024 09:30:16 -0400 X-MC-Unique: CPZzB4LfOUWvDD7GE_l0mg-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 563E019560B0 for ; Wed, 26 Jun 2024 13:30:15 +0000 (UTC) Received: from amusil.brq.redhat.com (unknown [10.43.17.32]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 048273000221; Wed, 26 Jun 2024 13:30:13 +0000 (UTC) From: Ales Musil To: dev@openvswitch.org Date: Wed, 26 Jun 2024 15:30:06 +0200 Message-ID: <20240626133007.694177-4-amusil@redhat.com> In-Reply-To: <20240626133007.694177-1-amusil@redhat.com> References: <20240626133007.694177-1-amusil@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 3/4] ovn-nbctl: Avoid uninitialized value for mirror index. 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: dceara@redhat.com Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The local mirror doesn't have an index, avoid storing uninitialized value in that case. Also prevent from index printing for local mirrors. Signed-off-by: Ales Musil --- tests/ovn-nbctl.at | 9 +++++++++ utilities/ovn-nbctl.c | 8 +++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/tests/ovn-nbctl.at b/tests/ovn-nbctl.at index 19c83a4a5..31de30921 100644 --- a/tests/ovn-nbctl.at +++ b/tests/ovn-nbctl.at @@ -452,6 +452,7 @@ OVN_NBCTL_TEST([ovn_nbctl_mirrors], [mirrors], [ check ovn-nbctl mirror-add mirror1 gre 0 from-lport 10.10.10.1 check ovn-nbctl mirror-add mirror2 erspan 1 to-lport 10.10.10.2 check ovn-nbctl mirror-add mirror3 gre 2 to-lport 10.10.10.3 +check ovn-nbctl mirror-add mirror-local local both 10.10.10.3 check ovn-nbctl ls-add sw0 check ovn-nbctl lsp-add sw0 sw0-port1 check ovn-nbctl lsp-add sw0 sw0-port2 @@ -480,6 +481,11 @@ check_column "$mirror3uuid" nb:Logical_Switch_Port mirror_rules name=sw0-port3 dnl Verify if multiple ports are attached to the same mirror properly AT_CHECK([ovn-nbctl mirror-list], [0], [dnl +mirror-local: + Type : local + Sink : 10.10.10.3 + Filter : both + mirror1: Type : gre Sink : 10.10.10.1 @@ -500,6 +506,9 @@ mirror3: ]) +dnl Remove the local mirror +check ovn-nbctl mirror-del mirror-local + dnl Detach one source port from mirror check ovn-nbctl lsp-detach-mirror sw0-port3 mirror3 diff --git a/utilities/ovn-nbctl.c b/utilities/ovn-nbctl.c index 32ca4f750..c37cc010c 100644 --- a/utilities/ovn-nbctl.c +++ b/utilities/ovn-nbctl.c @@ -7691,7 +7691,7 @@ nbctl_mirror_add(struct ctl_context *ctx) const char *sink = NULL; const char *type = NULL; const char *name = NULL; - int64_t index; + int64_t index = -1; char *error = NULL; const struct nbrec_mirror *mirror_check = NULL; int pos = 1; @@ -7824,8 +7824,10 @@ nbctl_mirror_list(struct ctl_context *ctx) ds_put_format(&ctx->output, " Type : %s\n", mirror->type); ds_put_format(&ctx->output, " Sink : %s\n", mirror->sink); ds_put_format(&ctx->output, " Filter : %s\n", mirror->filter); - ds_put_format(&ctx->output, " Index/Key: %ld\n", - (long int) mirror->index); + if (strcmp(mirror->type, "local")) { + ds_put_format(&ctx->output, " Index/Key: %"PRId64"\n", + mirror->index); + } ds_put_cstr(&ctx->output, "\n"); } From patchwork Wed Jun 26 13:30:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ales Musil X-Patchwork-Id: 1952633 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=DjnmcZm6; 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 4W8MyY64C9z20X1 for ; Wed, 26 Jun 2024 23:30:29 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id C9C2A40D97; Wed, 26 Jun 2024 13:30:27 +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 qUa5BJSPfgfl; Wed, 26 Jun 2024 13:30:26 +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 smtp4.osuosl.org A8B6640D57 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=DjnmcZm6 Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id A8B6640D57; Wed, 26 Jun 2024 13:30:25 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 46700C002B; Wed, 26 Jun 2024 13:30:25 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 66C71C0078 for ; Wed, 26 Jun 2024 13:30:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 3AF8C81F95 for ; Wed, 26 Jun 2024 13:30:21 +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 ob_tlnvcOQ9Q for ; Wed, 26 Jun 2024 13:30:20 +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 smtp1.osuosl.org 43DAF81D5F Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 43DAF81D5F Authentication-Results: smtp1.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=DjnmcZm6 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id 43DAF81D5F for ; Wed, 26 Jun 2024 13:30:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719408619; 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=9XwXc95PBpj0MtVT8DBB+XZnzQPjM0U4xMmLOZZzCq4=; b=DjnmcZm6UMJdYssNInMoNy4HIXcO9LwMnfBoCp/XsgFAGTd6a9ROJHv+7dPaQvbFsgzrNI tLYnro/m3cFQAwX2vU9LZj9z9EKPHfFm057po4aD0lOmC+pUiXERPBXyTopfsgwHPxVsVQ 1XXQICJWbtd/mp0mNLQw9BhQKlAk7uE= Received: from mx-prod-mc-05.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-686-opYbEFhsMTC9ZrCXF6qYPw-1; Wed, 26 Jun 2024 09:30:17 -0400 X-MC-Unique: opYbEFhsMTC9ZrCXF6qYPw-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D344719560B2 for ; Wed, 26 Jun 2024 13:30:16 +0000 (UTC) Received: from amusil.brq.redhat.com (unknown [10.43.17.32]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9489E3000225; Wed, 26 Jun 2024 13:30:15 +0000 (UTC) From: Ales Musil To: dev@openvswitch.org Date: Wed, 26 Jun 2024 15:30:07 +0200 Message-ID: <20240626133007.694177-5-amusil@redhat.com> In-Reply-To: <20240626133007.694177-1-amusil@redhat.com> References: <20240626133007.694177-1-amusil@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 4/4] treewide: Prevent potential NULL ptr deref. 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: dceara@redhat.com Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Prevent potential NULL ptr deref that might have happened in corner case. Signed-off-by: Ales Musil --- northd/northd.c | 2 +- utilities/ovn-ic-nbctl.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/northd/northd.c b/northd/northd.c index 7e474a7b8..b4d8e069b 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -16180,8 +16180,8 @@ build_lflows_thread(void *arg) &lsi->actions); } } + lsi->thread_lflow_counter = thread_lflow_counter; } - lsi->thread_lflow_counter = thread_lflow_counter; post_completed_work(control); } return NULL; diff --git a/utilities/ovn-ic-nbctl.c b/utilities/ovn-ic-nbctl.c index 4317c385a..77a69df0b 100644 --- a/utilities/ovn-ic-nbctl.c +++ b/utilities/ovn-ic-nbctl.c @@ -821,7 +821,7 @@ do_ic_nbctl(const char *args, struct ctl_command *commands, size_t n_commands, const struct icnbrec_ic_nb_global *inb = icnbrec_ic_nb_global_first(idl); if (!inb) { /* XXX add verification that table is empty */ - icnbrec_ic_nb_global_insert(txn); + inb = icnbrec_ic_nb_global_insert(txn); } if (wait_type != NBCTL_WAIT_NONE) {