Commit 7eb0e28c authored by Pavel Skripkin's avatar Pavel Skripkin Committed by Linus Torvalds

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: 1da177e4 ("Linux-2.6.12-rc2")
Signed-off-by: default avatarPavel Skripkin <paskripkin@gmail.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ba1f70dd
...@@ -474,10 +474,8 @@ static int v7_fill_super(struct super_block *sb, void *data, int silent) ...@@ -474,10 +474,8 @@ static int v7_fill_super(struct super_block *sb, void *data, int silent)
struct sysv_sb_info *sbi; struct sysv_sb_info *sbi;
struct buffer_head *bh; struct buffer_head *bh;
if (440 != sizeof (struct v7_super_block)) BUILD_BUG_ON(sizeof(struct v7_super_block) != 440);
panic("V7 FS: bad super-block size"); BUILD_BUG_ON(sizeof(struct sysv_inode) != 64);
if (64 != sizeof (struct sysv_inode))
panic("sysv fs: bad i-node size");
sbi = kzalloc(sizeof(struct sysv_sb_info), GFP_KERNEL); sbi = kzalloc(sizeof(struct sysv_sb_info), GFP_KERNEL);
if (!sbi) if (!sbi)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment