Skip to content

Commit f888356

Browse files
ZhangPenggregkh
authored andcommitted
hostfs: Fix the NULL vs IS_ERR() bug for __filemap_get_folio()
[ Upstream commit bed2cc4 ] The __filemap_get_folio() function returns error pointers. It never returns NULL. So use IS_ERR() to check it. Fixes: 1da8661 ("fs: Convert aops->write_begin to take a folio") Signed-off-by: ZhangPeng <zhangpeng362@huawei.com> Acked-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent fb014a3 commit f888356

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

fs/hostfs/hostfs_kern.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,8 @@ static int hostfs_write_begin(struct file *file, struct address_space *mapping,
471471

472472
*foliop = __filemap_get_folio(mapping, index, FGP_WRITEBEGIN,
473473
mapping_gfp_mask(mapping));
474-
if (!*foliop)
475-
return -ENOMEM;
474+
if (IS_ERR(*foliop))
475+
return PTR_ERR(*foliop);
476476
return 0;
477477
}
478478

0 commit comments

Comments
 (0)