blob: f2966a786c788f69713a31d371902aca241f1034 [file] [log] [blame]
From: Dan Carpenter <dan.carpenter@linaro.org>
Subject: hugetlbfs: fix an NULL vs IS_ERR() bug
Date: Thu, 28 Sep 2023 08:17:36 +0300
This code was converted from using find_lock_page() which returns NULL,
to calling filemap_lock_hugetlb_folio() which returns -ENOENT. The
check needs to be updated to match. Also IS_ERR() has an unlikely()
built in so we can remove that.
Link: https://lkml.kernel.org/r/1772c296-1417-486f-8eef-171af2192681@moroto.mountain
Fixes: 4649d8d5bb81 ("mm/filemap: remove hugetlb special casing in filemap.c")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
fs/hugetlbfs/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/fs/hugetlbfs/inode.c~mm-filemap-remove-hugetlb-special-casing-in-filemapc-fix
+++ a/fs/hugetlbfs/inode.c
@@ -354,7 +354,7 @@ static ssize_t hugetlbfs_read_iter(struc
/* Find the folio */
folio = filemap_lock_hugetlb_folio(h, mapping, index);
- if (unlikely(folio == NULL)) {
+ if (IS_ERR(folio)) {
/*
* We have a HOLE, zero out the user-buffer for the
* length of the hole or request.
_