From nobody Mon Jun 29 19:25:47 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gpx8D4N8Kz6jjZD for ; Mon, 29 Jun 2026 19:25:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gpx8D0CQGz40Qc for ; Mon, 29 Jun 2026 19:25:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1782761148; 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=hwyySOeKRcUdP46hT9OIdsW2czOPUbHvP3yLFIZZHvk=; b=Q11EJH3V2Usrm1/k8oyubfKDArM4DEHfvZf2axoUV0O9UFpSu9Vv15ShK9CxnzchwlaHpY 6IfEcGIzKwsZG1y4YbnDyw/eIU1STy8bmBRUKu0d/YyBv9wEJI03FThZjFLhmryeTOBjFs XZCse4sPRJHhUrh9KAfbPRLVHxMyYQOryLPd7SygIDKsmaGBSdNYUWGrdYAYqINr4hPICi E5APOOw+qRvHFlVW7wUJdUzj4hC1CTwbS/BE/qCXmfCETk2gNQGVM+ZJpaWGY0lYLWjmkU 4jk2u8f26ZBWfdKxusSS/mMh23E5Xw9xHQTfdeVeY6wvK6h+fPV2ZTNNUmeYVg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1782761148; a=rsa-sha256; cv=none; b=lWzo6rzMmJwIiS4KUjv6QHwYaT3R1wFzijaRk9y4Eym51LArAnkX+sRjR+HGi2s3m9C0Ja O63dqW9H01w5N0wP69Y/of0ReP6ClK1Cu49OLVrVyUjVy7QumxewYAzKeUyWvdRlKDLh7I TJXfc06TwFFfPFZVOJKgKMuXxWgfH+w9HyGLNd65i84PENIZK+eztxFPKPzuM8LV2GeJKx gCsZabeM8bJNbaUQnvVvfmnNtbVmeUdYbkYtR8MneiTCx0P2PM5TFvY2PAh+sWHgOSsNtM kXfrDnfwv56j6vB+6BV9ctgYIheM3wI20WzGIfrzpbhYOWOUMj/VYpT/10qCDw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1782761148; 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=hwyySOeKRcUdP46hT9OIdsW2czOPUbHvP3yLFIZZHvk=; b=neD5cwAtT90P2Z1vq7xRovnStmXmEOf/NEqeJGTL1rNhnwntV/M4vuPL22ASF5wEe2wN0f 0OLA0f/PBxFkaKFgKn3XXoeSFP4b6yckthhgRMLWtzIWZ7lbkCo+j6z9J4cVri3nREeZJQ WSeBUmm3QxTASODjAuwuBHFCjKLNBrX0bBW9GOmUIdBKu1cZHulKSdGCq7nXl4YW1xgpdA RyNexeL7+axqCndpYuNjDFZ3RVpnkgQa/NF9N/Ik+9ZqjvR0ziUkGGQWQnDdCQD4ah5hMk LIzQ8oi8zEm1rmk9xChh5jJN33jszVyH6wti5mYyoHKdzylqVSBRlD9oH7K4iw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gpx8C5yC5z196g for ; Mon, 29 Jun 2026 19:25:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 21b72 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 29 Jun 2026 19:25:47 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: c8394ff0c615 - stable/15 - MAC/do: Move static assertions on constants close to their definitions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: c8394ff0c61514f3fc73f705450061883874e337 Auto-Submitted: auto-generated Date: Mon, 29 Jun 2026 19:25:47 +0000 Message-Id: <6a42c6bb.21b72.3cc74e42@gitrepo.freebsd.org> The branch stable/15 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=c8394ff0c61514f3fc73f705450061883874e337 commit c8394ff0c61514f3fc73f705450061883874e337 Author: Olivier Certner AuthorDate: 2026-05-20 09:38:37 +0000 Commit: Olivier Certner CommitDate: 2026-06-29 19:23:45 +0000 MAC/do: Move static assertions on constants close to their definitions And document more clearly their purpose. Reviewed by: bapt MFC after: 1 month Sponsored by: The FreeBSD Foundation Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/38 (cherry picked from commit 4e27cc086b3f9e029160da8830abacb06a2f9e39) --- sys/security/mac_do/mac_do.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index f2206c85c489..8868a6eb432f 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -47,10 +47,14 @@ SYSCTL_INT(_security_mac_do, OID_AUTO, print_parse_error, CTLFLAG_RWTUN, static MALLOC_DEFINE(M_MAC_DO, "mac_do", "mac_do(4) security module"); +#define MAX_RULE_STRING_SIZE 1024 +_Static_assert(MAX_RULE_STRING_SIZE > 0, + "MAX_RULE_STRING_SIZE: No space for the NUL terminator!"); + #define MAX_EXEC_PATHS_SIZE 2048 #define MAX_EXEC_PATHS 8 - -#define MAX_RULE_STRING_SIZE 1024 +_Static_assert(MAX_EXEC_PATHS_SIZE > 0, + "MAX_EXEC_PATHS_SIZE: No space for the NUL terminator!"); static unsigned osd_jail_slot; static unsigned osd_thread_slot; @@ -355,14 +359,12 @@ toast_rules(struct rules *const rules) static void init_rules(struct rules *const rules) { - _Static_assert(MAX_RULE_STRING_SIZE > 0, "MAX_RULE_STRING_SIZE <= 0!"); STAILQ_INIT(&rules->head); } static void init_exec_paths(struct exec_paths *const exec_paths) { - _Static_assert(MAX_EXEC_PATHS_SIZE > 0, "MAX_EXEC_PATHS_SIZE <= 0!"); bzero(exec_paths, sizeof(*exec_paths)); exec_paths->exec_paths_str[0] = 0; }