From nobody Fri Dec 06 02:06:06 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 4Y4F3f540sz5g5Wh; Fri, 06 Dec 2024 02:06:06 +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 4Y4F3f34H4z41YC; Fri, 6 Dec 2024 02:06:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733450766; 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=oD4JibFSzsM4KdCdhyxMqkAZiq1+TNIchFaI5k7qPyo=; b=UC40oq07FPe0rIgaF8ZHjhsf5xNlH3Zg75WCZ1gaxQt+TQZ1e2h95/uDUmPbsTva5OOakX sw+m+fqOJfxd056WeRg1cCdIDHQDXLGr9WmX1R7hw4tLy6ok+mIk0GR+lgNItsyJ9H8iQO dRT2DHjQhCShEpefoWEkedxOmVW45ARCZrjusQTjA7auDLMtljWOIc+9qqlf7+yz+HSYCN yqE4K2k0x8fyrKIbrKBBKy+2/63g/LBFAbNHwMxFHZ21MvLbUlLnEACzsAXCl5fcJDxsV+ AQbW4Japp/7Jb+1wOvXFlej6789bIA2mngqRBpjNTf5faJK+x67ZhaB4tUZ8qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733450766; 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=oD4JibFSzsM4KdCdhyxMqkAZiq1+TNIchFaI5k7qPyo=; b=YoKSdnGIsyvyWcvSGz6Y4sDDwIyrIwxHgpQdYChsGDFZ7NbcxsoANmq9rB5fXOEayKszNp 4Cgy6DHBfD5Y+vgxdNx6rqCVSOXy2kkH0Wlkis2BAFlKwMA5MGh6wPjJXXZERUAE0bmdaF uw8rgebhJO/a3/GmRt/efnGYt18ZJq94YPNH+idwnIlsL1QH41NWzr6tZZjz4nOKKGYOjf ZZjHcCnVJrmjGj94k/z+yYJstdNfYXZP1g+hmDITpDlklVGlPPH8jsqtV4PlIze7ij4iyp 9nnqfZpW9xfYRRXhLKBUdAwkVqUgIpjdbsuex8aEJa4gBj/1pKwDJw/zWILYJQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733450766; a=rsa-sha256; cv=none; b=lRkx61+zUJmPfiCFRsrssZv7UVuFsDlOZ7aFF2U6bCyKCLAnuTiqfl/E1BPi1YM10sJ018 CeIJYFY2NohrYwg8dXp4FuvRcEO6pai2ifYXSbzyPbyoauYLQLeQdI9HgS6yBmK4wo1U5f mj8rRDEeXTYlQj0kPOj4JpDTvOtOSuYFOVUJJmss9t18I+cRddUmrELZJAwk5G+EW3HpM3 cC55qVTpFvXtt8ClBRG+TkfyN4wWRj+TXMf/Ji2GsOECfR//QQSj1eDeoJno28aEWE8hJS 1n7PO1HGspMz02F/jfnLnZByhuSxwc6D2nPLSwKXTK4o9hI7V1ey8apVV7zaOQ== 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 4Y4F3f2YThzJWp; Fri, 6 Dec 2024 02:06:06 +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 4B62660a096455; Fri, 6 Dec 2024 02:06:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B6266Ja096452; Fri, 6 Dec 2024 02:06:06 GMT (envelope-from git) Date: Fri, 6 Dec 2024 02:06:06 GMT Message-Id: <202412060206.4B6266Ja096452@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: bfc8e3308bee - main - ext2fs: Fix the size of struct ufid and add a static assert 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: bfc8e3308bee23d0f7836d57f32ed8d47da02627 Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=bfc8e3308bee23d0f7836d57f32ed8d47da02627 commit bfc8e3308bee23d0f7836d57f32ed8d47da02627 Author: Rick Macklem AuthorDate: 2024-12-06 02:05:06 +0000 Commit: Rick Macklem CommitDate: 2024-12-06 02:05:06 +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 --- 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 dfbb11f75421..064c10bd18b2 100644 --- a/sys/fs/ext2fs/ext2_vnops.c +++ b/sys/fs/ext2fs/ext2_vnops.c @@ -1889,6 +1889,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 9ee1b5672da6..63102deb10b0 100644 --- a/sys/fs/ext2fs/inode.h +++ b/sys/fs/ext2fs/inode.h @@ -191,7 +191,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_ */