aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2024-12-06 02:03:59 +0000
committerMark Johnston <markj@FreeBSD.org>2024-12-06 02:24:26 +0000
commit205659c43d87bd42c4a0819fde8f81e8ebba068e (patch)
tree044510895e7ebb0c4bb6a0b6b66ffb37261631e1
parent4db1b113b15158c7d134df83e7a7201cf46d459b (diff)
cd9660: Make sure that struct ifid fits in generic filehandle structure
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 packs the structure and checks via a __Static_assert(). Reported by: Kevin Miller <mas@0x194.net> Reviewed by: olce, imp, kib, emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D47879
-rw-r--r--sys/fs/cd9660/cd9660_vnops.c3
-rw-r--r--sys/fs/cd9660/iso.h2
2 files changed, 4 insertions, 1 deletions
diff --git a/sys/fs/cd9660/cd9660_vnops.c b/sys/fs/cd9660/cd9660_vnops.c
index 33ca58472490..c41fccb394c2 100644
--- a/sys/fs/cd9660/cd9660_vnops.c
+++ b/sys/fs/cd9660/cd9660_vnops.c
@@ -758,6 +758,9 @@ cd9660_pathconf(struct vop_pathconf_args *ap)
/* NOTREACHED */
}
+_Static_assert(sizeof(struct ifid) <= sizeof(struct fid),
+ "struct ifid must be no larger than struct fid");
+
/*
* Vnode pointer to File handle
*/
diff --git a/sys/fs/cd9660/iso.h b/sys/fs/cd9660/iso.h
index a9733f62c077..9b737e261a63 100644
--- a/sys/fs/cd9660/iso.h
+++ b/sys/fs/cd9660/iso.h
@@ -267,7 +267,7 @@ struct ifid {
u_short ifid_pad;
cd_ino_t ifid_ino;
long ifid_start;
-};
+} __packed;
#define VFSTOISOFS(mp) ((struct iso_mnt *)((mp)->mnt_data))