This patch adds a max block count for f2fs_map_blocks Signed-off-by: Yunlei He <heyun...@huawei.com> Signed-off-by: Xue Liu <liuxueliu....@huawei.com> --- fs/f2fs/data.c | 4 ++++ fs/f2fs/f2fs.h | 3 +++ 2 files changed, 7 insertions(+)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index e34b1bd..2a16c867 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -578,6 +578,10 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, map->m_len = 0; map->m_flags = 0; + /* We can handle the block number less than F2FS_MAX_BLOCKS */ + if (unlikely(map->m_lblk >= F2FS_MAX_BLOCKS)) + return -EUCLEAN; + /* it only supports block size == page size */ pgofs = (pgoff_t)map->m_lblk; diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 19beabe..911c99b 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -331,6 +331,9 @@ enum { #define F2FS_LINK_MAX 0xffffffff /* maximum link count per file */ + +#define F2FS_MAX_BLOCKS 0x3F015AFF /* maximum block count per file */ + #define MAX_DIR_RA_PAGES 4 /* maximum ra pages of dir */ /* vector size for gang look-up from extent cache that consists of radix tree */ -- 1.9.1 ------------------------------------------------------------------------------ _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel