Skip to contentSkip to conversation

mkfs.f2fs: ensure zone size is a multiple of segment size

PATCH In review Daeho Jeong 2 participants 2 messages May 27, 2025 – May 28, 2025 Library code

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 mkfs.f2fs: ensure zone size is a multiple of segment size

From: Daeho Jeong <[email protected]>

Otherwise, it doesn't work with a crash.

---
v3: make the condition to be a multiple of segment size
v2: relocate the code

---
 lib/libf2fs.c | 6 ++++++
 1 file changed, 6 insertions(+)
lib/libf2fs.c +6 -0
index d2579d7..7a9245e 100644
@@ -1347,6 +1347,12 @@ int f2fs_get_f2fs_info(void)
 			}
 			c.zone_blocks = c.devices[i].zone_blocks;
 		}
+		if (!c.zone_blocks ||
+				(c.zone_blocks % DEFAULT_BLOCKS_PER_SEGMENT)) {
+			MSG(0, "\tError: zone size should be a multiple of "
+				"segment size\n");
+			return -1;
+		}
 
 		/*
 		 * Align sections to the device zone size and align F2FS zones
Signature · 1 line
2.49.0.1151.ga128411c76-goog