提交 4aa69d56 编写于 作者: J Jaegeuk Kim

f2fs: return early when trying to read null nid

If get_node_page() gets zero nid, we can return early without getting a wrong
page. For example, get_dnode_of_data() can try to do that.
Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
上级 2aadac08
...@@ -1059,6 +1059,10 @@ struct page *get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid) ...@@ -1059,6 +1059,10 @@ struct page *get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid)
{ {
struct page *page; struct page *page;
int err; int err;
if (!nid)
return ERR_PTR(-ENOENT);
f2fs_bug_on(sbi, check_nid_range(sbi, nid));
repeat: repeat:
page = grab_cache_page(NODE_MAPPING(sbi), nid); page = grab_cache_page(NODE_MAPPING(sbi), nid);
if (!page) if (!page)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册