]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
gfs2: Fix a NULL vs IS_ERR() bug in gfs2_find_jhead()
authorDan Carpenter <dan.carpenter@linaro.org>
Wed, 12 Mar 2025 08:33:03 +0000 (11:33 +0300)
committerAndreas Gruenbacher <agruenba@redhat.com>
Wed, 12 Mar 2025 12:00:28 +0000 (13:00 +0100)
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>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/lops.c

index 3853c422040b1c588e9186023da25734817f920e..0fd3b5ec7d8cce58823e1fd4b9d115eb8a298505 100644 (file)
@@ -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;
                                }