From nobody Fri Jan 17 14:00:40 2025 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 4YZLwm3S4cz5l1vs; Fri, 17 Jan 2025 14:00:40 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZLwm2ZlYz3q92; Fri, 17 Jan 2025 14:00:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737122440; 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=5a5nU/WIK5+f/zu/yIPQJ061DYrwNjuam8remalmpv0=; b=YTaVwetCzne/micwKo2S/qg7ny7ApaBgApz4ef+UbT2i4JeYJbnAPNZbs4KDeDFNHxd9Y8 Djyw4Xo5zfv34BzCNR7CMqNY0w6eR6w8Yy4rQzccqzEf+0IAyD4XcrQGVkDH+sFZACqWtN l7irEQDM4KdDsYnX51BlPSGLl7WZP23t7QEADEY6yQGA8QNGVdt/0E2roWSVuD0uOTPKAm 7m805Uk5RQUpYgQzPvr7Q//my2gDhTXl0zzNckPVRvs3g9oI/3AFfisYsSQSYcTxynb+8h k3prlXZIAUBdyEvLo61uPv4D2DrztJRKcdASC/Ai0yfIv9puCLC/jTM4gFkJKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737122440; 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=5a5nU/WIK5+f/zu/yIPQJ061DYrwNjuam8remalmpv0=; b=mtlRQ8QBCbApXxFvjJ5iTrCXcET/F41mwvUvCePCmISE0P/3v6F99WtH/th4+b/rgY3WTH KnOmMIz+obgdqIWiY3turfXvvXpj6cwOf4JZK6B/BWDYVAiTas1vnag2pp6egRyXnHyny0 inTeKODZifJWqYZAgYzG2tmi5vVsnv6YKg7COVWQrUojfu8uDR06d8VuH9Cf8MxWftbBjz yp/bX2yTGOeKvAre2GuFDWWtDL1M6LrpaSa2/N9M0URatdJC/cA2cXx7ip4tSXQQAWgbDQ zsbbTKxsvy6mM6KfXAmAuwtVfPyTIq/RIQo4lE/nSnfYiCCETiw94z9Qea8AAg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737122440; a=rsa-sha256; cv=none; b=lgGnnj2oOo7hCM2QkwiUZKpiv2WttWRMpayHfifdNuGdCGY/jndRawXnU2CaXuik8r2lYe i/7Qim7rUlEspChPYxoQCJo2sXpk8PyhbR1teaaDAg/ac9zdizZZx/WjZuyKL87IaXRPjr ShO5AsEZWBlu8DocE0+OwQCzULA05wSUcYBG7OkzB6elbPXCR//6IzhRPTKPX8mWiAEAqF qC5UEJvkSIHqN+u1LUTihOji0cI2PzrvvaKWpPZIVpcXXSrS8mdZu6SEbXrfsqSUgLCbMU fnLpRZyUx9LlGZBkUDkAFPoUsfQ4GA4/PQ8pjQ8vwjLG8LtJFSMWfovcQG0qLA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YZLwm1yYRz4wn; Fri, 17 Jan 2025 14:00:40 +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 50HE0eBj034710; Fri, 17 Jan 2025 14:00:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50HE0elF034707; Fri, 17 Jan 2025 14:00:40 GMT (envelope-from git) Date: Fri, 17 Jan 2025 14:00:40 GMT Message-Id: <202501171400.50HE0elF034707@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: ee931cf4a49c - stable/13 - ext2fs: Fix the size of struct ufid and add a static assert 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ee931cf4a49c90487c938fa14b856401582a045c Auto-Submitted: auto-generated The branch stable/13 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=ee931cf4a49c90487c938fa14b856401582a045c commit ee931cf4a49c90487c938fa14b856401582a045c Author: Rick Macklem AuthorDate: 2024-12-06 02:05:06 +0000 Commit: Olivier Certner CommitDate: 2025-01-17 13:59:44 +0000 ext2fs: Fix the size of struct ufid and add a static assert 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 packed the structure and checks via a __Static_assert(). Reviewed by: markj MFC after: 2 weeks (cherry picked from commit bfc8e3308bee23d0f7836d57f32ed8d47da02627) --- sys/fs/ext2fs/ext2_vnops.c | 2 ++ sys/fs/ext2fs/inode.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/fs/ext2fs/ext2_vnops.c b/sys/fs/ext2fs/ext2_vnops.c index 01b94abf6cd5..63c4830b95be 100644 --- a/sys/fs/ext2fs/ext2_vnops.c +++ b/sys/fs/ext2fs/ext2_vnops.c @@ -1884,6 +1884,8 @@ ext2_vptofh(struct vop_vptofh_args *ap) { 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; diff --git a/sys/fs/ext2fs/inode.h b/sys/fs/ext2fs/inode.h index 6b8b23ccab14..c29a64be12e0 100644 --- a/sys/fs/ext2fs/inode.h +++ b/sys/fs/ext2fs/inode.h @@ -189,7 +189,7 @@ struct ufid { uint16_t ufid_pad; /* Force 32-bit alignment. */ ino_t ufid_ino; /* File number (ino). */ uint32_t ufid_gen; /* Generation number. */ -}; +} __packed; #endif /* _KERNEL */ #endif /* !_FS_EXT2FS_INODE_H_ */