From: ZhangPeng Date: Mon, 4 Nov 2024 12:34:40 +0000 (+0800) Subject: hostfs: Fix the NULL vs IS_ERR() bug for __filemap_get_folio() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=bed2cc482600296fe04edbc38005ba2851449c10;p=users%2Fjedix%2Flinux-maple.git 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 Acked-by: Johannes Berg Signed-off-by: Richard Weinberger --- 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; }