From: Peng Zhang <zhangpeng362@huawei.com>
To: <linux-um@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Cc: <richard@nod.at>, <anton.ivanov@cambridgegreys.com>,
<johannes@sipsolutions.net>, <willy@infradead.org>,
<josef@toxicpanda.com>, <brauner@kernel.org>,
<zhangxiaoxu5@huawei.com>, <wanghai38@huawei.com>,
<zhangpeng362@huawei.com>
Subject: [PATCH] hostfs: Fix the NULL vs IS_ERR() bug for __filemap_get_folio()
Date: Mon, 4 Nov 2024 20:34:40 +0800 [thread overview]
Message-ID: <20241104123440.1347175-1-zhangpeng362@huawei.com> (raw)
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
next reply other threads:[~2024-11-04 12:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-04 12:34 Peng Zhang [this message]
2024-11-08 9:17 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241104123440.1347175-1-zhangpeng362@huawei.com \
--to=zhangpeng362@huawei.com \
--cc=anton.ivanov@cambridgegreys.com \
--cc=brauner@kernel.org \
--cc=johannes@sipsolutions.net \
--cc=josef@toxicpanda.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-um@lists.infradead.org \
--cc=richard@nod.at \
--cc=wanghai38@huawei.com \
--cc=willy@infradead.org \
--cc=zhangxiaoxu5@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®