From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=fail (p=quarantine dis=none) header.from=redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 04A505A0269 for ; Fri, 20 Nov 2026 01:15:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1795133736; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5FgIcpDJa0cNHKEdo4S99+X4t3amAOOyT8Y7UZfoxR8=; b=XUyC2FdXkLhqnxHaF+ZiV6HlOTs58UAOv5hpWf8d7QDYcY1ePdmKxWKQYu/OBE+0xKvF5c OPwCJrm3lJhlIKmIGVuk0X/xNC5bOR6JJQWYGD6sXke/95/iWc19M/H9lo1bTR5OCWElwz hN/rzL+lAhi+P9GrGhRNz228kQFEGRE= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-541-9VY0eRArP7m6jtH6xSp1rQ-1; Fri, 20 Nov 2026 00:15:33 +0000 X-MC-Unique: 9VY0eRArP7m6jtH6xSp1rQ-1 X-Mimecast-MFC-AGG-ID: 9VY0eRArP7m6jtH6xSp1rQ_1795133732 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 55979180134C; Fri, 20 Nov 2026 00:15:31 +0000 (UTC) Received: from jmaloy-thinkpadp16vgen1.redhat.corp (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 658AA1801976; Fri, 20 Nov 2026 00:15:30 +0000 (UTC) From: Jon Maloy To: sbrivio@redhat.com, david@gibson.dropbear.id.au, jmaloy@redhat.com, passt-dev@passt.top Subject: [PATCH] flow: Reduce scope of type_or_state in flow_log__() Date: Thu, 19 Nov 2026 19:15:29 -0500 Message-ID: <20261120001529.1440334-1-jmaloy@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: h3RVLDu1RZNdxO1D_rTAkGYUVXnCSuauW0E2G_emQt8_1795133732 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: EW4ZI3Y5ATYFVDIFIL6SEOXVWSJEAMGB X-Message-ID-Hash: EW4ZI3Y5ATYFVDIFIL6SEOXVWSJEAMGB X-MailFrom: jmaloy@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Since commit bfbd2deae0c3 ("flow: Handle NULL (unknown) flows in flow logging functions"), type_or_state is only used in the branch handling non-NULL flows, and cppcheck points out that its scope can be reduced, causing 'make cppcheck' to fail. We do that here. Fixes: bfbd2deae0c3 ("flow: Handle NULL (unknown) flows in flow logging functions") Signed-off-by: Jon Maloy --- flow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flow.c b/flow.c index 27a24a4c..f9fbaefe 100644 --- a/flow.c +++ b/flow.c @@ -286,7 +286,6 @@ int flowside_connect(const struct ctx *c, int s, void flow_log__(const struct flow_common *f, int pri, bool perror, bool details, enum flow_state state, const char *fmt, ...) { - const char *type_or_state; int errno_ = errno; char msg[BUFSIZ]; va_list args; @@ -299,6 +298,8 @@ void flow_log__(const struct flow_common *f, int pri, bool perror, bool details, logmsg(!perror, false, pri, "Flow: not found, error: %s", msg); details = false; } else { + const char *type_or_state; + /* Show type if it's set, otherwise the state */ if (f->state < FLOW_STATE_TYPED) type_or_state = FLOW_STATE(f); -- 2.56.1