From patchwork Tue May 28 11:39:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eelco Chaudron X-Patchwork-Id: 1940444 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=BuacPmLc; 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 4VpW1v6HQqz20Q9 for ; Tue, 28 May 2024 21:46:27 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id E8F424069D; Tue, 28 May 2024 11:46:25 +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 Af2lMBUTzIAt; Tue, 28 May 2024 11:46:22 +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 33BFF4069F 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=BuacPmLc Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 33BFF4069F; Tue, 28 May 2024 11:46:22 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id F27A4C007C; Tue, 28 May 2024 11:46:21 +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 255EBC0DD7 for ; Tue, 28 May 2024 11:46:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 5B7454152B for ; Tue, 28 May 2024 11:46:17 +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 uNG-Ubxpp2XO for ; Tue, 28 May 2024 11:46:16 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=echaudro@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org 5E34341511 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 5E34341511 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=BuacPmLc 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 5E34341511 for ; Tue, 28 May 2024 11:46:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716896775; 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=PWPsQ2bUZKaUka7YoLFONN4G+iLsoKKZkVpbyjktgok=; b=BuacPmLc4UCjDNxfuYTDmYUdczVsZKdSMkv3HA5qtrgs9YsMUvRQt/5zwztYv3NR+TVbif PmDBO6OBC2sLr8+6y64Wkr1VbWXvJN3unx/CIrMs6VQVOR/p8UnV29ln6STKCJPIs12pCz Y0Fx5Xrm9YjL0pauBzk7uBzR7XircBc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-349--N8scq-uNNSxgokLsO5yrg-1; Tue, 28 May 2024 07:46:12 -0400 X-MC-Unique: -N8scq-uNNSxgokLsO5yrg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id CA360801948; Tue, 28 May 2024 11:46:11 +0000 (UTC) Received: from ebuild.redhat.com (unknown [10.39.192.113]) by smtp.corp.redhat.com (Postfix) with ESMTP id 116FC200A6E7; Tue, 28 May 2024 11:46:10 +0000 (UTC) From: Eelco Chaudron To: dev@openvswitch.org Date: Tue, 28 May 2024 13:39:35 +0200 Message-ID: <85c69f387ee4998ca32a384f24b1b757e9f649b0.1716896375.git.echaudro@redhat.com> In-Reply-To: <6432a0813cc432e76b9a6ec8f1ff835d88a30818.1716896375.git.echaudro@redhat.com> References: <6432a0813cc432e76b9a6ec8f1ff835d88a30818.1716896375.git.echaudro@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: i.maximets@ovn.org Subject: [ovs-dev] [PATCH v2 7/8] db-ctl-base: Initialize the output variable in the ctx structure. 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" Coverity was flagged that the uninitialized output variable was used in the ctl_context_init_command() function. This patch initializes the variable. In addition it also destroys the ds string in ctl_context_done() in case it's not cleared properly. Fixes: 07ff77ccb82a ("db-ctl-base: Make common database command code into library.") Signed-off-by: Eelco Chaudron --- lib/db-ctl-base.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/db-ctl-base.c b/lib/db-ctl-base.c index 3a8068b12..b3e9b92d1 100644 --- a/lib/db-ctl-base.c +++ b/lib/db-ctl-base.c @@ -2656,6 +2656,7 @@ ctl_context_init(struct ctl_context *ctx, struct ctl_command *command, struct ovsdb_symbol_table *symtab, void (*invalidate_cache_cb)(struct ctl_context *)) { + ds_init(&ctx->output); if (command) { ctl_context_init_command(ctx, command, false); } @@ -2688,6 +2689,7 @@ ctl_context_done(struct ctl_context *ctx, ctl_context_done_command(ctx, command); } invalidate_cache(ctx); + ds_destroy(&ctx->output); } char * OVS_WARN_UNUSED_RESULT