Skip to contentSkip to conversation

sysv-use-build_bug_on-instead-of-runtime-check.patch removed from -mm tree

merged [email protected] 1 participant 1 message Nov 11, 2021

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: sysv: use BUILD_BUG_ON instead of runtime check
has been removed from the -mm tree. Its filename was
sysv-use-build_bug_on-instead-of-runtime-check.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Pavel Skripkin <[email protected]>
Subject: 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

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc Christoph Hellwig <[email protected]>

---

 fs/sysv/super.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
fs/sysv/super.c renamed from fs/sysv/super.c~sysv-use-build_bug_on-instead-of-runtime-check +2 -4
@@ -474,10 +474,8 @@ static int v7_fill_super(struct super_bl
 	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)

_

Patches currently in -mm which might be from [email protected] are