[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20241104123440.1347175-1-zhangpeng362@huawei.com>
Date: Mon, 4 Nov 2024 20:34:40 +0800
From: Peng Zhang <zhangpeng362@...wei.com>
To: <linux-um@...ts.infradead.org>, <linux-kernel@...r.kernel.org>
CC: <richard@....at>, <anton.ivanov@...bridgegreys.com>,
<johannes@...solutions.net>, <willy@...radead.org>, <josef@...icpanda.com>,
<brauner@...nel.org>, <zhangxiaoxu5@...wei.com>, <wanghai38@...wei.com>,
<zhangpeng362@...wei.com>
Subject: [PATCH] hostfs: Fix the NULL vs IS_ERR() bug for __filemap_get_folio()
From: ZhangPeng <zhangpeng362@...wei.com>
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@...wei.com>
---
fs/hostfs/hostfs_kern.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 6d1cf2436ead..084f6ed2dd7a 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -471,8 +471,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;
}
--
2.25.1
Powered by blists - more mailing lists