mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH next] squashfs: Fix a NULL vs IS_ERR() bug
@ 2025-01-08  9:16 Dan Carpenter
  2025-01-14 21:06 ` Phillip Lougher
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-01-08  9:16 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Phillip Lougher, Andrew Morton, linux-kernel, kernel-janitors

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@linaro.org>
---
 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


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

end of thread, other threads:[~2025-01-14 21:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-08  9:16 [PATCH next] squashfs: Fix a NULL vs IS_ERR() bug Dan Carpenter
2025-01-14 21:06 ` Phillip Lougher

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®