diff options
author | Chao Yu <yuchao0@huawei.com> | 2019-01-09 10:48:25 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2019-03-27 07:02:28 -0700 |
commit | 92ea71c711681a8f575d09d57d5ceaebd6644fcc (patch) | |
tree | 8c1f28953a3836ffe4d7d2712b55b59bcce9b272 | |
parent | 979b25727800bd44d0e9f5a4e0e8d7f39130bb02 (diff) | |
download | f2fs-tools-92ea71c711681a8f575d09d57d5ceaebd6644fcc.tar.gz |
fsck.f2fs: fix incorrect boundary of IS_VALID_NID()
nid should never equal to max_nid, fix it.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | fsck/f2fs.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fsck/f2fs.h b/fsck/f2fs.h index 0d0d5e2..93f01e5 100644 --- a/fsck/f2fs.h +++ b/fsck/f2fs.h @@ -369,13 +369,16 @@ static inline block_t sum_blk_addr(struct f2fs_sb_info *sbi, int base, int type) static inline bool IS_VALID_NID(struct f2fs_sb_info *sbi, u32 nid) { - return (nid <= (NAT_ENTRY_PER_BLOCK * + return (nid < (NAT_ENTRY_PER_BLOCK * le32_to_cpu(F2FS_RAW_SUPER(sbi)->segment_count_nat) << (sbi->log_blocks_per_seg - 1))); } static inline bool IS_VALID_BLK_ADDR(struct f2fs_sb_info *sbi, u32 addr) { + if (addr == NULL_ADDR || addr == NEW_ADDR) + return 1; + if (addr >= le64_to_cpu(F2FS_RAW_SUPER(sbi)->block_count) || addr < SM_I(sbi)->main_blkaddr) { DBG(1, "block addr [0x%x]\n", addr); |