mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH next] gfs2: Fix a NULL vs IS_ERR() bug in gfs2_find_jhead()
@ 2025-03-12  8:33 Dan Carpenter
  2025-03-12 12:06 ` Andreas Grünbacher
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-03-12  8:33 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: Andreas Gruenbacher, gfs2, linux-kernel, kernel-janitors

The filemap_grab_folio() function doesn't return NULL, it returns error
pointers.  Fix the check to match.

Fixes: 40829760096d ("gfs2: Convert gfs2_find_jhead() to use a folio")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 fs/gfs2/lops.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
index 3853c422040b..0fd3b5ec7d8c 100644
--- a/fs/gfs2/lops.c
+++ b/fs/gfs2/lops.c
@@ -530,8 +530,8 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head,
 			if (!folio) {
 				folio = filemap_grab_folio(mapping,
 						block >> shift);
-				if (!folio) {
-					ret = -ENOMEM;
+				if (IS_ERR(folio)) {
+					ret = PTR_ERR(folio);
 					done = true;
 					goto out;
 				}
-- 
2.47.2


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

* Re: [PATCH next] gfs2: Fix a NULL vs IS_ERR() bug in gfs2_find_jhead()
  2025-03-12  8:33 [PATCH next] gfs2: Fix a NULL vs IS_ERR() bug in gfs2_find_jhead() Dan Carpenter
@ 2025-03-12 12:06 ` Andreas Grünbacher
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Grünbacher @ 2025-03-12 12:06 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Matthew Wilcox, Andreas Gruenbacher, gfs2, linux-kernel, kernel-janitors

Am Mi., 12. März 2025 um 09:33 Uhr schrieb Dan Carpenter
<dan.carpenter@linaro.org>:
> The filemap_grab_folio() function doesn't return NULL, it returns error
> pointers.  Fix the check to match.
>
> Fixes: 40829760096d ("gfs2: Convert gfs2_find_jhead() to use a folio")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  fs/gfs2/lops.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
> index 3853c422040b..0fd3b5ec7d8c 100644
> --- a/fs/gfs2/lops.c
> +++ b/fs/gfs2/lops.c
> @@ -530,8 +530,8 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head,
>                         if (!folio) {
>                                 folio = filemap_grab_folio(mapping,
>                                                 block >> shift);
> -                               if (!folio) {
> -                                       ret = -ENOMEM;
> +                               if (IS_ERR(folio)) {
> +                                       ret = PTR_ERR(folio);
>                                         done = true;
>                                         goto out;
>                                 }
> --
> 2.47.2

Applied, thanks.

Andreas

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

end of thread, other threads:[~2025-03-12 12:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-12  8:33 [PATCH next] gfs2: Fix a NULL vs IS_ERR() bug in gfs2_find_jhead() Dan Carpenter
2025-03-12 12:06 ` Andreas Grünbacher

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®