From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=WU0zLyzz; dkim-atps=neutral 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 DD23F5A0288 for ; Tue, 13 May 2025 11:41:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1747129274; 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=2pnHZXWVe5ge2+00+gzK1scDyTlUNcAt8gTsBH+x6QU=; b=WU0zLyzzgiiePfSfi/lq+GbVGwDpJe+sK6FxZcwLP8+QilxCfBF6edMUQh4IFUOCYp1dVF A81gzlay59sF4evHqEpaH+tUXjIAIu878FsIBSZa/b2QvrtphL2nlgCfv4pyq0V3FkMPB3 0MS/20xqKyzNxnhzJm2rBvvr96m9yX4= 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-301-rEjzoUidPjOHsJPqNsT1Jg-1; Tue, 13 May 2025 05:41:13 -0400 X-MC-Unique: rEjzoUidPjOHsJPqNsT1Jg-1 X-Mimecast-MFC-AGG-ID: rEjzoUidPjOHsJPqNsT1Jg_1747129272 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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6B56C1800446 for ; Tue, 13 May 2025 09:41:12 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.44.33.64]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4EC471945CB4; Tue, 13 May 2025 09:41:11 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH 4/4] flow: Fix clang error (clang-analyzer-security.PointerSub) Date: Tue, 13 May 2025 11:41:02 +0200 Message-ID: <20250513094102.1372330-5-lvivier@redhat.com> In-Reply-To: <20250513094102.1372330-1-lvivier@redhat.com> References: <20250513094102.1372330-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: gWa_FCemwEa7PdyMDRJLSb1pGjp4XnwSwNNi9DqDT-w_1747129272 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: 26WDVPZEJVFF5NDIFKJO5SLC3HS3PCE5 X-Message-ID-Hash: 26WDVPZEJVFF5NDIFKJO5SLC3HS3PCE5 X-MailFrom: lvivier@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 CC: Laurent Vivier 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: Fixes the following clang-analyzer warning: flow_table.h:96:25: note: Subtraction of two pointers that do not point into the same array is undefined behavior 96 | return (union flow *)f - flowtab; The `flow_idx()` function is called via `FLOW_IDX()` from `flow_foreach_slot()`, where `f` is set to `&flowtab[idx].f`. Therefore, `f` and `flowtab` do point to the same array. Signed-off-by: Laurent Vivier --- flow_table.h | 1 + 1 file changed, 1 insertion(+) diff --git a/flow_table.h b/flow_table.h index 2d5c65ca4d94..3f3f4b7527bf 100644 --- a/flow_table.h +++ b/flow_table.h @@ -93,6 +93,7 @@ extern union flow flowtab[]; */ static inline unsigned flow_idx(const struct flow_common *f) { + /* NOLINTNEXTLINE(clang-analyzer-security.PointerSub) */ return (union flow *)f - flowtab; } -- 2.49.0