From: Dan Carpenter Date: Wed, 12 Mar 2025 08:33:03 +0000 (+0300) Subject: gfs2: Fix a NULL vs IS_ERR() bug in gfs2_find_jhead() X-Git-Tag: v6.15-rc1~154^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=951d701ef1bbce4c5f88466f5e829fb3d5735856;p=thirdparty%2Flinux.git gfs2: Fix a NULL vs IS_ERR() bug in gfs2_find_jhead() 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 Signed-off-by: Andreas Gruenbacher --- diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c index 3853c422040b1..0fd3b5ec7d8cc 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; }