Skip to content

Commit bed2cc4

Browse files
ZhangPengrichardweinberger
ZhangPeng
authored andcommitted
hostfs: Fix the NULL vs IS_ERR() bug for __filemap_get_folio()
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 <[email protected]> Acked-by: Johannes Berg <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
1 parent 2f681ba commit bed2cc4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/hostfs/hostfs_kern.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,8 @@ static int hostfs_write_begin(struct file *file, struct address_space *mapping,
472472

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

0 commit comments

Comments
 (0)