diff options
author | ZhangPeng <zhangpeng362@huawei.com> | 2024-11-04 20:34:40 +0800 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2024-11-15 20:55:32 +0100 |
commit | bed2cc482600296fe04edbc38005ba2851449c10 (patch) | |
tree | 19798268ec9b74145a4e0f03447404b2ed50db36 /fs/hostfs | |
parent | 2f681ba4b352cdd5658ed2a96062375a12839755 (diff) |
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: 1da86618bdce ("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>
Diffstat (limited to 'fs/hostfs')
-rw-r--r-- | fs/hostfs/hostfs_kern.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 8d47c6b70c9f..7e51d2cec64b 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c @@ -472,8 +472,8 @@ static int hostfs_write_begin(struct file *file, struct address_space *mapping, *foliop = __filemap_get_folio(mapping, index, FGP_WRITEBEGIN, mapping_gfp_mask(mapping)); - if (!*foliop) - return -ENOMEM; + if (IS_ERR(*foliop)) + return PTR_ERR(*foliop); return 0; } |