Commit 843609df authored by Dan Carpenter's avatar Dan Carpenter Committed by David Howells

netfs: Fix a NULL vs IS_ERR() check in netfs_perform_write()

The netfs_grab_folio_for_write() function doesn't return NULL, it returns
error pointers.  Update the check accordingly.

Fixes: c38f4e96 ("netfs: Provide func to copy data to pagecache for buffered write")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/r/29fb1310-8e2d-47ba-b68d-40354eb7b896@moroto.mountain/
parent 3be0b3ed
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment