linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] filemap: Fix error propagation in do_read_cache_page()
@ 2022-09-21  9:10 Alexander Larsson
  2022-09-21 17:16 ` Al Viro
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Larsson @ 2022-09-21  9:10 UTC (permalink / raw)
  To: willy; +Cc: linux-fsdevel, Alexander Larsson

When do_read_cache_folio() returns an error pointer the code
was dereferencing it rather than forwarding the error via
ERR_CAST().

Found during code review.

Fixes: 539a3322f208 ("filemap: Add read_cache_folio and read_mapping_folio")
Signed-off-by: Alexander Larsson <alexl@redhat.com>
---
 mm/filemap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index 15800334147b..6bc55506f7a8 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -3560,7 +3560,7 @@ static struct page *do_read_cache_page(struct address_space *mapping,
 
 	folio = do_read_cache_folio(mapping, index, filler, file, gfp);
 	if (IS_ERR(folio))
-		return &folio->page;
+		return ERR_CAST(folio);
 	return folio_file_page(folio, index);
 }
 
-- 
2.37.3


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

end of thread, other threads:[~2022-09-24 21:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-21  9:10 [PATCH] filemap: Fix error propagation in do_read_cache_page() Alexander Larsson
2022-09-21 17:16 ` Al Viro
2022-09-22  8:06   ` Alexander Larsson
2022-09-24 21:43   ` Matthew Wilcox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).