From nobody Fri Dec 06 01:57:38 2024 X-Original-To: dev-commits-src-main@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 4Y4Dsv238kz5g40D; Fri, 06 Dec 2024 01:57:39 +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 4Y4Dsv1KwNz40XS; Fri, 6 Dec 2024 01:57:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733450259; 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=ZqesQzgv/WR1+jRpo2GB7bpUc0cH1LwHFowTQmf+VzE=; b=bCxDCF91ZY2hnwdQKkqc8CLKx/uoDKv8ZV+PQ3wLQEcxsYY+2jmTQQlGUYufhkkbwVdvt8 zF0HkFACpFT+iZLsIcb0kQQ3lIrpQ48ZGcMcWg0p//ySmdVstKNhEuoob3MSOqb9YmdfJQ kbEreY88NVhEO13fPE0c16awQGM/L3X3g4RG3J8ut/7vroVthr2h3LKpS7zcNdoNVVKyw/ HE/tqzd/bZQkinJV4CEbFgfIK6kTX4DiHpT60GY/3pzNMWkMnKgy+qPMqD/3fsTW84pI9v CZqxtHhYsz1R8O0/C/YOkVzBod4//263Oy4cj3YbIGwKcHr2TLybrMLzW5XNjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733450259; 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=ZqesQzgv/WR1+jRpo2GB7bpUc0cH1LwHFowTQmf+VzE=; b=s/W/wmNz/suupOn+OZGHJ2ovVPUjgRrXMYsUvOXL+WZljGa4opFmUKQIGgwrlJJSd+ZKFp Qqqz4WasoxQF8qN3+CJ+fqqtS3GMsADl0AYrwTmoLrgGBofPgbaA6oq9qtRAP0xE3uHb/l GQwIrUqlp1Bx3V1mRi6xo6okM4DvPYuLYvpKUv0MiIVDZyNxLWXJfsI3J+jIT1FjSs0RC0 ISg2sI+SCB3lY8+K7X0FBGkpwfwGzO2SkYSCXdKZ7zV15x9QFq7j7uZ8GvVWZyQZtyvFOe ayKjxmXadf3OYDANqQtLXf5u2WLbfitAWKBQUiWi1wg93sIuW4c00h4x7X3U4A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733450259; a=rsa-sha256; cv=none; b=CeCcPoiWk0nlKcSLrn1b1941CIsifXhsU390NjxFokx945yg6xgGAv40vSjAnMtMYqrs4O 6SWZJ2/y/25IrE+//XE+1/ryaRGFe0dGbhZgSbimHaSmJieuDlru4NjyuuByef3DgWRTlm +D9gU1NYv4k7h2qolmkLrn4F66SfEFPSw+DSkigzj3BGk0whlaw6LtvSe9soSpSMIK/KHJ i43i7unCTblMI0GezaQ/EHM1YmziE/kcpQLe3B2T9j3mZhDOivgFY0JTuek8+fF3He/AAW MCKm3VTJWXbry43eRk2dLo+Lb+iZOnpQgT0PvUJa2EfPQDEmatJ+h+AdTCUadQ== 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 4Y4Dsv0pxyzJ14; Fri, 6 Dec 2024 01:57:39 +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 4B61vd8Z077729; Fri, 6 Dec 2024 01:57:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B61vcxh077726; Fri, 6 Dec 2024 01:57:38 GMT (envelope-from git) Date: Fri, 6 Dec 2024 01:57:38 GMT Message-Id: <202412060157.4B61vcxh077726@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 91b5592a1e1a - main - fs: Add static asserts for the size of fid structures List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 91b5592a1e1af97480d615cf508be05b5674d2f3 Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=91b5592a1e1af97480d615cf508be05b5674d2f3 commit 91b5592a1e1af97480d615cf508be05b5674d2f3 Author: Rick Macklem AuthorDate: 2024-12-06 01:56:23 +0000 Commit: Rick Macklem CommitDate: 2024-12-06 01:56:23 +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. Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D47936 --- 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 428c31f3c59a..162977b8abf7 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -1709,6 +1709,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 e9849008cde2..6e83741975fd 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -1919,6 +1919,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;