mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] hostfs: Fix the NULL vs IS_ERR() bug for __filemap_get_folio()
@ 2024-11-04 12:34 Peng Zhang
  2024-11-08  9:17 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: Peng Zhang @ 2024-11-04 12:34 UTC (permalink / raw)
  To: linux-um, linux-kernel
  Cc: richard, anton.ivanov, johannes, willy, josef, brauner,
	zhangxiaoxu5, wanghai38, zhangpeng362

From: ZhangPeng <zhangpeng362@huawei.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@huawei.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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] hostfs: Fix the NULL vs IS_ERR() bug for __filemap_get_folio()
  2024-11-04 12:34 [PATCH] hostfs: Fix the NULL vs IS_ERR() bug for __filemap_get_folio() Peng Zhang
@ 2024-11-08  9:17 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2024-11-08  9:17 UTC (permalink / raw)
  To: Peng Zhang, linux-um, linux-kernel, Christian Brauner
  Cc: richard, anton.ivanov, willy, josef, brauner, zhangxiaoxu5, wanghai38

On Mon, 2024-11-04 at 20:34 +0800, Peng Zhang wrote:
> From: ZhangPeng <zhangpeng362@huawei.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@huawei.com>

Not sure it's critical, but for um I wasn't planning to send a pull
request for 6.12-rc (and I suspect Richard also wasn't, as there are no
other fixes). Also, the original commit went through another tree.

Christian what do you think? Do you want to pick it up? Or should we
pick it up via um, but then likely only for 6.13?

If you could pick it up:
Acked-by: Johannes Berg <johannes@sipsolutions.net>

johannes


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-08  9:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-04 12:34 [PATCH] hostfs: Fix the NULL vs IS_ERR() bug for __filemap_get_folio() Peng Zhang
2024-11-08  9:17 ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®