summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Skripkin <paskripkin@gmail.com>2021-10-28 13:25:53 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2021-10-28 13:25:53 +1100
commitd5dceb2b4413e3d12a5781cf5b6c445f84f6428d (patch)
tree246555dfb34f3f977b7e05f14eb16598c33d7216
parent3802213e06786e2c1f131672c0711319e27f51e7 (diff)
downloadlinux-d5dceb2b4413e3d12a5781cf5b6c445f84f6428d.tar.gz
linux-d5dceb2b4413e3d12a5781cf5b6c445f84f6428d.tar.xz
sysv: use BUILD_BUG_ON instead of runtime check
There were runtime checks about sizes of struct v7_super_block and struct sysv_inode. If one of these checks fail the kernel will panic. Since these values are known at compile time let's use BUILD_BUG_ON(), because it's a standard mechanism for validation checking at build time Link: https://lkml.kernel.org/r/20210813123020.22971-1-paskripkin@gmail.com Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Pavel Skripkin <paskripkin@gmail.com> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
-rw-r--r--fs/sysv/super.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/sysv/super.c b/fs/sysv/super.c
index cc8e2ed155c8..d1def0771a40 100644
--- a/fs/sysv/super.c
+++ b/fs/sysv/super.c
@@ -474,10 +474,8 @@ static int v7_fill_super(struct super_block *sb, void *data, int silent)
struct sysv_sb_info *sbi;
struct buffer_head *bh;
- if (440 != sizeof (struct v7_super_block))
- panic("V7 FS: bad super-block size");
- if (64 != sizeof (struct sysv_inode))
- panic("sysv fs: bad i-node size");
+ BUILD_BUG_ON(sizeof(struct v7_super_block) != 440);
+ BUILD_BUG_ON(sizeof(struct sysv_inode) != 64);
sbi = kzalloc(sizeof(struct sysv_sb_info), GFP_KERNEL);
if (!sbi)