Skip to content

Commit

Permalink
netfs: Fix a NULL vs IS_ERR() check in netfs_perform_write()
Browse files Browse the repository at this point in the history
The netfs_grab_folio_for_write() function doesn't return NULL, it returns
error pointers.  Update the check accordingly.

Fixes: c38f4e9 ("netfs: Provide func to copy data to pagecache for buffered write")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/r/29fb1310-8e2d-47ba-b68d-40354eb7b896@moroto.mountain/
  • Loading branch information
Dan Carpenter authored and David Howells committed Jan 22, 2024
1 parent 3be0b3e commit 843609d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/netfs/buffered_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,11 @@ ssize_t netfs_perform_write(struct kiocb *iocb, struct iov_iter *iter,
if (unlikely(fault_in_iov_iter_readable(iter, part) == part))
break;

ret = -ENOMEM;
folio = netfs_grab_folio_for_write(mapping, pos, part);
if (!folio)
if (IS_ERR(folio)) {
ret = PTR_ERR(folio);
break;
}

flen = folio_size(folio);
offset = pos & (flen - 1);
Expand Down

0 comments on commit 843609d

Please sign in to comment.