[PATCH next] squashfs: Fix a NULL vs IS_ERR() bug
From: Dan Carpenter
Date: Wed Jan 08 2025 - 04:17:04 EST
The __filemap_get_folio() functoin never returns NULL, it returns
error pointers. This incorrect check would lead to an Oops on the
following line when we pass "push_folio" to folio_test_uptodate().
Fixes: 43c73ba98b2c ("squashfs; convert squashfs_copy_cache() to take a folio")
Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
---
fs/squashfs/file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/squashfs/file.c b/fs/squashfs/file.c
index da25d6fa45ce..eef1dd462592 100644
--- a/fs/squashfs/file.c
+++ b/fs/squashfs/file.c
@@ -409,7 +409,7 @@ void squashfs_copy_cache(struct folio *folio,
FGP_LOCK|FGP_CREAT|FGP_NOFS|FGP_NOWAIT,
mapping_gfp_mask(mapping));
- if (!push_folio)
+ if (IS_ERR(push_folio))
continue;
if (folio_test_uptodate(push_folio))
--
2.45.2