summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-06-21 00:31:49 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-06-21 03:32:17 -0400
commit5ec09018877f19f1264248565551f166de8931cc (patch)
tree40fa99b99c9207e82f34944db3ab510289f6ebcd
parent06af36bd671a7832dbdb15a948ef0f13a2ed49d7 (diff)
bcachefs: Check for ERR_PTR() from filemap_lock_folio()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/fs-io.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index 8fce1a73e690..6d814164a4e9 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -124,7 +124,7 @@ static int filemap_get_contig_folios_d(struct address_space *mapping,
break;
f = __filemap_get_folio(mapping, pos >> PAGE_SHIFT, fgp_flags, gfp);
- if (!f)
+ if (IS_ERR_OR_NULL(f))
break;
BUG_ON(folios->nr && folio_pos(f) != pos);
@@ -1764,7 +1764,7 @@ int bch2_write_begin(struct file *file, struct address_space *mapping,
folio = __filemap_get_folio(mapping, pos >> PAGE_SHIFT,
FGP_LOCK|FGP_WRITE|FGP_CREAT|FGP_STABLE,
mapping_gfp_mask(mapping));
- if (!folio)
+ if (IS_ERR_OR_NULL(folio))
goto err_unlock;
if (folio_test_uptodate(folio))
@@ -2846,7 +2846,7 @@ static int __bch2_truncate_folio(struct bch_inode_info *inode,
u64 end_pos;
folio = filemap_lock_folio(mapping, index);
- if (!folio) {
+ if (IS_ERR_OR_NULL(folio)) {
/*
* XXX: we're doing two index lookups when we end up reading the
* folio
@@ -2859,7 +2859,7 @@ static int __bch2_truncate_folio(struct bch_inode_info *inode,
folio = __filemap_get_folio(mapping, index,
FGP_LOCK|FGP_CREAT, GFP_KERNEL);
- if (unlikely(!folio)) {
+ if (unlikely(IS_ERR_OR_NULL(folio))) {
ret = -ENOMEM;
goto out;
}
@@ -3782,7 +3782,7 @@ static bool folio_hole_offset(struct address_space *mapping, loff_t *offset)
bool ret = true;
folio = filemap_lock_folio(mapping, *offset >> PAGE_SHIFT);
- if (!folio)
+ if (IS_ERR_OR_NULL(folio))
return true;
s = bch2_folio(folio);