Skip to content

Commit 11839a7

Browse files
Maxim PleshivenkovJaegeuk Kim
authored andcommitted
f2fs-tools: handle total_sectors is zero
touch crash.img ./out/host/linux-x86/bin/make_f2fs -g android -b 16384 crash.img F2FS-tools: mkfs.f2fs Ver: 1.16.0 (2023-04-11) Info: Debug level = 1 Info: Trim is enabled Info: Set conf for android Info: Enable Project quota Info: not exist /proc/version! Info: Segments per section = 1 Info: Sections per zone = 1 Info: sector size = 512 Info: total sectors = 0 (0 MB) Info: block size = 16384 Info: zone aligned segment0 blkaddr: 512 AddressSanitizer:DEADLYSIGNAL ================================================================= ==300581==ERROR: AddressSanitizer: FPE on unknown address 0x5625f4833664 (pc 0x5625f4833664 bp 0x7ffd7745c070 sp 0x7ffd7745bdd0 T0) #0 0x5625f4833664 in get_reserved external/f2fs-tools/include/f2fs_fs.h:1873:42 #1 0x5625f4833664 in get_best_overprovision external/f2fs-tools/include/f2fs_fs.h:1900:14 #2 0x5625f4833664 in f2fs_prepare_super_block external/f2fs-tools/mkfs/f2fs_format.c:579:21 #3 0x5625f4833664 in f2fs_format_device external/f2fs-tools/mkfs/f2fs_format.c:1884:7 #4 0x5625f4821e94 in main external/f2fs-tools/mkfs/f2fs_format_main.c:562:6 #5 0x7fb54fe94ca7 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16 #6 0x7fb54fe94d64 in __libc_start_main csu/../csu/libc-start.c:360:3 #7 0x5625f473b008 in _start (/usr/local/google/home/mpleshivenkov/src/b_479167542/main/out/host/linux-x86/bin/make_f2fs+0x9b008) (BuildId: 10870ae26d00ed4dfb428b9204c19b93) ==300581==Register values: rax = 0x00000000ffffffff rbx = 0x00000ac4be913cb8 rcx = 0x0000000000000000 rdx = 0x0000000000000000 rdi = 0x00005625f48a702c rsi = 0x00000000ffffffff rbp = 0x00007ffd7745c070 rsp = 0x00007ffd7745bdd0 r8 = 0x00005625f4895da0 r9 = 0x00000000fffe96a3 r10 = 0x00000ac4be914e05 r11 = 0x00005625f489e5c0 r12 = 0x00005625f48a7014 r13 = 0x00000000fffe96a3 r14 = 0x00000ac4be914e02 r15 = 0x00000ac4be914e02 AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: FPE external/f2fs-tools/include/f2fs_fs.h:1873:42 in get_reserved ==300581==ABORTING Signed-off-by: Maxim Pleshivenkov <mpleshivenkov@google.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent f2d9e6f commit 11839a7

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

mkfs/f2fs_format.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,9 @@ static int f2fs_prepare_super_block(void)
341341

342342
for (i = 0; i < c.ndevs; i++) {
343343
if (i == 0) {
344+
if (c.devices[i].total_sectors * c.sector_size <
345+
zone_align_start_offset)
346+
goto too_small;
344347
c.devices[i].total_segments =
345348
((c.devices[i].total_sectors *
346349
c.sector_size - zone_align_start_offset) /

0 commit comments

Comments
 (0)