mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
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 bfc8e3308b)
This commit is contained in:
1 parent
1bf531bcd7
commit
ee931cf4a4
2 files changed
+3
-1
No files matched your search
@@ -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;
|
||||
|
||||
@@ -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_ */
|
||||
Reference in new issue
Block a user