Skip to contentSkip to conversation

f2fs-tools: sanity check segment count

PATCH New Jin Qian 1 participant 1 message Apr 25, 2017

lore
Share & tools
lore

Jin Qian

author
#0 lore raw

PATCH 1/1 f2fs-tools: sanity check segment count

make sure segment count in super block doesn't exceed F2FS_MAX_SEGMENT.

---
 fsck/mount.c | 3 +++
 1 file changed, 3 insertions(+)
fsck/mount.c +3 -0
index 761baa0..0111960 100644
@@ -406,6 +406,9 @@ int sanity_check_raw_super(struct f2fs_super_block *sb, u64 offset)
 		return -1;
 	}
 
+	if (get_sb(segment_count) > F2FS_MAX_SEGMENT)
+		return -1;
+
 	if (sanity_check_area_boundary(sb, offset))
 		return -1;
 	return 0;
Signature · 6 lines
2.13.0.rc0.306.g87b477812d-goog


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot