From nobody Fri Dec 20 22:08:33 2024 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 4YFM4d34Qvz5h3sy; Fri, 20 Dec 2024 22:08:33 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YFM4d2b8mz4bgL; Fri, 20 Dec 2024 22:08:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734732513; 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=cDH1f30AO4Ci+C6RzlwbAsDeWHArjAosyK7lZy9JIKg=; b=AP0QgdNmPchvqunySsiT7FhzYFNLYrvJHQRp8cKRJYPqjq6rVDhUXwa5ZfVaapKOyNU8u2 Og6Wf4enT+SrvryKx1yRHMbUARK53Anq7F52fW9ItVCHmeFzb8fy92kV66xpqU3mt3/UYq 6pIX6pWTdwAWoY/4AYrzWgZeArP4ayXHr+xlb5zht2Iv9qZvrs6ZXD1T1aL9HU5xHeVZd4 dY5Sb6btNxJBldDRchdGcU1/3k9Lq2Q6WRFvExKLRT5feLGWSEWxFpc+Wb5OMnDXqUDU8D MWxUMn1X1xN1PNYjmQtr2HNvlcZfVU9BnK4v+bKo3M23TbQ6ygSWlwpz0h8heQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734732513; 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=cDH1f30AO4Ci+C6RzlwbAsDeWHArjAosyK7lZy9JIKg=; b=fE9FW4k7FSsMHAlXKFHS78H5K9r55HwKePbVoglenOi/zNme6shYnwSlEnqbOyBAXkE8wO WJdJJaKkYFfpE6T2g6mrMg6OVhNZRsbdP9Wlozbhg5ycMBIszTMeN4aCS16mxYMHmus6Dd Yk/93d0gzhn9Q0FoSAHt8xK4+uztk8cST8c073TyreADFnvzomkyyg6dqHkm42c7msqVRP JUL4SbBScVyUZdx5ZYPdv986Ssn7cxlnaAMZxrjJ7tzpJjBzd0JA5PciiIvKJiQf/qN7w/ APzJ+eNlcwLPlQeInClaHlz6F0tk2wROt107EqtM08/cI7CWHvHLPANhNyvQ0Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1734732513; a=rsa-sha256; cv=none; b=IVfmFix9yV7t5aX6ZS9bQUSPBM3uU8FfqRWUzRwaB7DP+XDebtLnxhk1S4Lw5t8LGkr6+A WtwOSRt0Z13xWao/V+9k2U6oqWvWLK97X6gWhEA5T0fKOuZvBgBXOLdtA58nQivZbeaB0A v3Qmn7p9xU+Azape9LvYyIysMyGUIhZBuYzkIeb2jcTwN7UV1pxJhFV5RjIIAUS5vFV/b2 HXCi75WFfTQqDA7K6qcAbli0T0N03CFyAzkwskMcPpcZBfC5oU/OsKZNbK7HPlzeBLLhdb PZyf1wp66ysUT6QDOiusntIZQ+bEbz6QHzAXBaz6RWJqPGsWj04hApnxCF9zaw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4YFM4d1tF8zwHB; Fri, 20 Dec 2024 22:08:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4BKM8Xjq038575; Fri, 20 Dec 2024 22:08:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BKM8XXh038572; Fri, 20 Dec 2024 22:08:33 GMT (envelope-from git) Date: Fri, 20 Dec 2024 22:08:33 GMT Message-Id: <202412202208.4BKM8XXh038572@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: efe6a0997383 - stable/14 - fs: Add static asserts for the size of fid structures 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: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: efe6a0997383d728290cd01c07d9cf59adc2ed05 Auto-Submitted: auto-generated The branch stable/14 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=efe6a0997383d728290cd01c07d9cf59adc2ed05 commit efe6a0997383d728290cd01c07d9cf59adc2ed05 Author: Rick Macklem AuthorDate: 2024-12-06 01:56:23 +0000 Commit: Rick Macklem CommitDate: 2024-12-20 22:07:12 +0000 fs: Add static asserts for the size of fid structures File system specific *fid structures are copied into the generic struct fid defined in sys/mount.h. As such, they cannot be larger than struct fid. This patch adds _Static_assert()s to check for this. ZFS and fuse already have _Static_assert()s. (cherry picked from commit 91b5592a1e1af97480d615cf508be05b5674d2f3) --- sys/fs/msdosfs/msdosfs_vnops.c | 2 ++ sys/fs/tmpfs/tmpfs_vnops.c | 2 ++ sys/fs/udf/udf_vnops.c | 2 ++ sys/ufs/ffs/ffs_vnops.c | 2 ++ 4 files changed, 8 insertions(+) diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index 078ea5e52312..6417b7dac16b 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -1962,6 +1962,8 @@ msdosfs_vptofh(struct vop_vptofh_args *ap) { struct denode *dep; struct defid *defhp; + _Static_assert(sizeof(struct defid) <= sizeof(struct fid), + "struct defid cannot be larger than struct fid"); dep = VTODE(ap->a_vp); defhp = (struct defid *)ap->a_fhp; diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 206a95350d2e..4571a2855be3 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -1687,6 +1687,8 @@ vop_vptofh { struct tmpfs_fid_data tfd; struct tmpfs_node *node; struct fid *fhp; + _Static_assert(sizeof(struct tmpfs_fid_data) <= sizeof(struct fid), + "struct tmpfs_fid_data cannot be larger than struct fid"); node = VP_TO_TMPFS_NODE(ap->a_vp); fhp = ap->a_fhp; diff --git a/sys/fs/udf/udf_vnops.c b/sys/fs/udf/udf_vnops.c index 98a779280690..88bf4917a851 100644 --- a/sys/fs/udf/udf_vnops.c +++ b/sys/fs/udf/udf_vnops.c @@ -1274,6 +1274,8 @@ udf_vptofh(struct vop_vptofh_args *a) { struct udf_node *node; struct ifid *ifhp; + _Static_assert(sizeof(struct ifid) <= sizeof(struct fid), + "struct ifid cannot be larger than struct fid"); node = VTON(a->a_vp); ifhp = (struct ifid *)a->a_fhp; diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index c14cb5e1ee66..0f60f8061043 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -1922,6 +1922,8 @@ ffs_vptofh( { struct inode *ip; struct ufid *ufhp; + _Static_assert(sizeof(struct ufid) <= sizeof(struct fid), + "struct ufid cannot be larger than struct fid"); ip = VTOI(ap->a_vp); ufhp = (struct ufid *)ap->a_fhp;