aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/ext2fs
diff options
context:
space:
mode:
Diffstat (limited to 'sys/fs/ext2fs')
-rw-r--r--sys/fs/ext2fs/ext2_extents.c2
-rw-r--r--sys/fs/ext2fs/ext2_vfsops.c2
-rw-r--r--sys/fs/ext2fs/ext2_vnops.c2
-rw-r--r--sys/fs/ext2fs/inode.h8
4 files changed, 8 insertions, 6 deletions
diff --git a/sys/fs/ext2fs/ext2_extents.c b/sys/fs/ext2fs/ext2_extents.c
index 3ae1da4fe6b7..146aa48f6743 100644
--- a/sys/fs/ext2fs/ext2_extents.c
+++ b/sys/fs/ext2fs/ext2_extents.c
@@ -711,7 +711,7 @@ ext4_ext_tree_init(struct inode *ip)
ip->i_flag |= IN_E4EXTENTS;
- memset(ip->i_data, 0, EXT2_NDADDR + EXT2_NIADDR);
+ memset(ip->i_data, 0, sizeof(ip->i_data));
ehp = (struct ext4_extent_header *)ip->i_data;
ehp->eh_magic = htole16(EXT4_EXT_MAGIC);
ehp->eh_max = htole16(ext4_ext_space_root(ip));
diff --git a/sys/fs/ext2fs/ext2_vfsops.c b/sys/fs/ext2fs/ext2_vfsops.c
index bffbf4546f37..9e7a03fffd71 100644
--- a/sys/fs/ext2fs/ext2_vfsops.c
+++ b/sys/fs/ext2fs/ext2_vfsops.c
@@ -1345,7 +1345,7 @@ ext2_fhtovp(struct mount *mp, struct fid *fhp, int flags, struct vnode **vpp)
return (ESTALE);
}
*vpp = nvp;
- vnode_create_vobject(*vpp, 0, curthread);
+ vnode_create_vobject(*vpp, ip->i_size, curthread);
return (0);
}
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..c45339bfde40 100644
--- a/sys/fs/ext2fs/inode.h
+++ b/sys/fs/ext2fs/inode.h
@@ -187,10 +187,10 @@ struct indir {
/* This overlays the fid structure (see mount.h). */
struct ufid {
- uint16_t ufid_len; /* Length of structure. */
- uint16_t ufid_pad; /* Force 32-bit alignment. */
- ino_t ufid_ino; /* File number (ino). */
- uint32_t ufid_gen; /* Generation number. */
+ uint16_t ufid_len; /* Length of structure. */
+ uint16_t ufid_pad; /* Force 32-bit alignment. */
+ uint32_t ufid_gen; /* Generation number. */
+ ino_t ufid_ino; /* File number (ino). */
};
#endif /* _KERNEL */