Skip to content

Commit 843609d

Browse files
Dan Carpenterdhowells
authored andcommitted
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: c38f4e9 ("netfs: Provide func to copy data to pagecache for buffered write") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: David Howells <[email protected]> Link: https://lore.kernel.org/r/[email protected]/
1 parent 3be0b3e commit 843609d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fs/netfs/buffered_write.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,11 @@ ssize_t netfs_perform_write(struct kiocb *iocb, struct iov_iter *iter,
221221
if (unlikely(fault_in_iov_iter_readable(iter, part) == part))
222222
break;
223223

224-
ret = -ENOMEM;
225224
folio = netfs_grab_folio_for_write(mapping, pos, part);
226-
if (!folio)
225+
if (IS_ERR(folio)) {
226+
ret = PTR_ERR(folio);
227227
break;
228+
}
228229

229230
flen = folio_size(folio);
230231
offset = pos & (flen - 1);

0 commit comments

Comments
 (0)