From nobody Thu Apr 23 18:48:10 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 4g1lTk65lkz6bK51 for ; Thu, 23 Apr 2026 18:48:10 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4g1lTk4QjQz3ckk for ; Thu, 23 Apr 2026 18:48:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776970090; 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=mGVBELCy+mxTiYFIVJCNIj7eUu9ctKv7QopHmeG0CmQ=; b=U/6xGHQfNMcEl6Z0IyO7S5zM8mNpuIN8yXquNaYbHzXwSaLWhvD8gRKOhB+JGbprkyB+gI JFMB81+slkHcnNRfnFG8IK1GO8WClsKg8P365FF/XZguBjUyXTXLaAket5r1HIoEk+XM2u xNqavp4cQo1v2PbfUzbd6jyyjKZUWEWEL2HRyLZm5whNUotZJ5F3iRhaanB/5auTA3KtsL ocuEsAbf3SNDYq5X0SZf+OCZ0NY1fQ+oN6mLZym9yvOY+dNRKKnkBep2cZebR4PPJnszLA FizQi4k2bGZ7Ak8s56mL74otGCkaXRb9o7Egnzp7G/dgMgs//5HRKsWigRX8YA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776970090; a=rsa-sha256; cv=none; b=jWPO3GZYigAwM/HhDb/ly34wBgRhG0cC/nV3/+3DGu1x+OQB/tox1Qxr+KMdua+h8LbXOL /UuM6a+PCKKX+ybZQ4MJ5F81P+qiAiwFD5GnPo8YjrhhC6rdnyL5aABMfLpA+xXAlt1E5r 0DIEioGwqZCjEA///pnJMrq7At8XmUAPlMIV26cO7FqNHfgIh5myvKA9kW3mDeUlW+yVhe OAtV+891lKt+IAdNMKOy1dj7NqgNSU9+JjCvvM4DScoUfejWPvOGrIWrApM1KQ762hvtLB mGgWaTSIYVA3GXrJNfTYf4K4cURRvuEvsn3Feh9FtShnZroyAOx2IN+Zli++HQ== 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=1776970090; 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=mGVBELCy+mxTiYFIVJCNIj7eUu9ctKv7QopHmeG0CmQ=; b=TRQ2ZWLzwsBXz4x4dQGt9fNP4/chVCqdkXs635JjDOVQMsxxEfR1NFPkm2TscqcnnuOl7O jg5prs4rLce+XrJaSc0DWvcqlMkTvD8wechWs2rNPu0JmtIM77N6MVwn5dHxm8qR2WJ4kP B3ZRFFz4KEaHfmMhFzwVR8JOFte6YxtXLrOCVLyL1kvnj/JZdknBQMBSVG3UMpmZtCgUeP uRl9bGBaUeg7Lw65zcR91PUeJ0yEZuGYUL8fIlZQgM3oVeeHxXXP8m7oxdXXKWIBkiJH2X rBLolBGuSoQ0rmJ0s7YNoZSePzb+nCKseREdHeSHtRI2GQ0tr1V+BMrz4zotXQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4g1lTk3blJzDMn for ; Thu, 23 Apr 2026 18:48:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 19551 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 23 Apr 2026 18:48:10 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 28b0084af332 - main - kern: mac: sprinkle a bit of const correctness 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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 28b0084af332c34af3bdc60354bb7feea8ceeaa3 Auto-Submitted: auto-generated Date: Thu, 23 Apr 2026 18:48:10 +0000 Message-Id: <69ea696a.19551.72a68ab8@gitrepo.freebsd.org> The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=28b0084af332c34af3bdc60354bb7feea8ceeaa3 commit 28b0084af332c34af3bdc60354bb7feea8ceeaa3 Author: Kyle Evans AuthorDate: 2026-04-23 18:47:09 +0000 Commit: Kyle Evans CommitDate: 2026-04-23 18:47:09 +0000 kern: mac: sprinkle a bit of const correctness mpc_name and mpc_fullname are string literals in correct usage, so they should really be const instead. mpc_ops aren't typically const, but the framework shouldn't be doing anything to clobber it; thus, good to constify it as a reminder. Switch to using a slightly more semantically correct `void **` in the fastpath bits while we're here, since we only do arithmetic on the outer layer of pointer and compare the inner to a pointer-typed (NULL). Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D55702 --- sys/security/mac/mac_framework.c | 10 +++++----- sys/security/mac/mac_policy.h | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/security/mac/mac_framework.c b/sys/security/mac/mac_framework.c index fec63b99c0e0..e1733f114a5d 100644 --- a/sys/security/mac/mac_framework.c +++ b/sys/security/mac/mac_framework.c @@ -417,7 +417,7 @@ mac_policy_update(void) * policies. Gross hack below enables doing it in a cheap manner. */ -#define FPO(f) (offsetof(struct mac_policy_ops, mpo_##f) / sizeof(uintptr_t)) +#define FPO(f) (offsetof(struct mac_policy_ops, mpo_##f) / sizeof(void *)) struct mac_policy_fastpath_elem { int count; @@ -488,12 +488,12 @@ static void mac_policy_fastpath_register(struct mac_policy_conf *mpc) { struct mac_policy_fastpath_elem *mpfe; - uintptr_t **ops; + const void * const *ops; int i; mac_policy_xlock_assert(); - ops = (uintptr_t **)mpc->mpc_ops; + ops = (const void * const *)mpc->mpc_ops; for (i = 0; i < nitems(mac_policy_fastpath_array); i++) { mpfe = &mac_policy_fastpath_array[i]; if (ops[mpfe->offset] != NULL) @@ -505,12 +505,12 @@ static void mac_policy_fastpath_unregister(struct mac_policy_conf *mpc) { struct mac_policy_fastpath_elem *mpfe; - uintptr_t **ops; + const void * const *ops; int i; mac_policy_xlock_assert(); - ops = (uintptr_t **)mpc->mpc_ops; + ops = (const void * const *)mpc->mpc_ops; for (i = 0; i < nitems(mac_policy_fastpath_array); i++) { mpfe = &mac_policy_fastpath_array[i]; if (ops[mpfe->offset] != NULL) diff --git a/sys/security/mac/mac_policy.h b/sys/security/mac/mac_policy.h index 03c0ea2f8550..4c6cb1b9b2d0 100644 --- a/sys/security/mac/mac_policy.h +++ b/sys/security/mac/mac_policy.h @@ -1070,9 +1070,9 @@ struct mac_policy_ops { * structure, as its layout is statically compiled into all policies. */ struct mac_policy_conf { - char *mpc_name; /* policy name */ - char *mpc_fullname; /* policy full name */ - struct mac_policy_ops *mpc_ops; /* policy operations */ + const char *mpc_name; /* policy name */ + const char *mpc_fullname; /* policy full name */ + const struct mac_policy_ops *mpc_ops; /* policy operations */ int mpc_loadtime_flags; /* flags */ int *mpc_field_off; /* security field */ int mpc_runtime_flags; /* flags */