From patchwork Mon Oct 23 14:22:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eelco Chaudron X-Patchwork-Id: 1853787 X-Patchwork-Delegate: horms@verge.net.au 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=VeoHbHoB; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.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 4SDcq14HbJz23jn for ; Tue, 24 Oct 2023 01:22:53 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 44A69611E3; Mon, 23 Oct 2023 14:22:51 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 44A69611E3 Authentication-Results: smtp3.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=VeoHbHoB X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id U0BkpA71NGeA; Mon, 23 Oct 2023 14:22:50 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id 3CC6B611C9; Mon, 23 Oct 2023 14:22:49 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 3CC6B611C9 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 01331C007F; Mon, 23 Oct 2023 14:22:49 +0000 (UTC) X-Original-To: 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 2482DC008D for ; Mon, 23 Oct 2023 14:22:48 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 1FD1C611BC for ; Mon, 23 Oct 2023 14:22:38 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 1FD1C611BC X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id n5HdSkwkw_pO for ; Mon, 23 Oct 2023 14:22:37 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 80007611C8 for ; Mon, 23 Oct 2023 14:22:37 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 80007611C8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698070956; 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=krurpeuWnHF5jAgGXSsWf1Hu5JL0vGLnkL7/ZWFXrZ0=; b=VeoHbHoBL+RQiHH/qM7UNpLFney4eVRpIU54NNxhh4rcMimCFRcSWudktE6yEGRDROt1iC YPpInI8DOsiWMvpXGX6afU2ae/0Ij7QUgcGcLROnBskNFZ2OtelPX0kh0EEAff340pxM3Y Xb+Q934IfTRXl/ZCF8bDUQxRRXUu7mo= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-494-Oe53y4qDM_eneDMplaqU6g-1; Mon, 23 Oct 2023 10:22:34 -0400 X-MC-Unique: Oe53y4qDM_eneDMplaqU6g-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2C607185A79B; Mon, 23 Oct 2023 14:22:34 +0000 (UTC) Received: from ebuild.redhat.com (unknown [10.39.195.140]) by smtp.corp.redhat.com (Postfix) with ESMTP id 98EBEC15BB8; Mon, 23 Oct 2023 14:22:33 +0000 (UTC) From: Eelco Chaudron To: dev@openvswitch.org Date: Mon, 23 Oct 2023 16:22:32 +0200 Message-ID: <169807095205.1031379.14112323533605146662.stgit@ebuild> In-Reply-To: <169807091380.1031379.16553136292085455374.stgit@ebuild> References: <169807091380.1031379.16553136292085455374.stgit@ebuild> User-Agent: StGit/1.5 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: i.maximets@ovn.org Subject: [ovs-dev] [PATCH v2 3/5] ofp-table: Fix count_common_prefix_run() function. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" It appears that an issue existed in the count_common_prefix_run() function from the beginning. This problem came to light while addressing 'Dead assignment' warnings identified by the Clang static analyzer. Instead of updating the extra_prefix_len with the current (next) value, the next value was inadvertently updated with extra_prefix_len. This patch rectifies this behavior. Fixes: 95a5454c5110 ("ofp-print: Abbreviate lists of fields in table features output.") Signed-off-by: Eelco Chaudron Reviewed-by: Simon Horman --- lib/ofp-table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ofp-table.c b/lib/ofp-table.c index a956754f2..f9bd3b7f9 100644 --- a/lib/ofp-table.c +++ b/lib/ofp-table.c @@ -1416,7 +1416,7 @@ count_common_prefix_run(const char *ids[], size_t n, if (!next) { break; } else if (next < extra_prefix_len) { - next = extra_prefix_len; + extra_prefix_len = next; } i++; }