Skip to contentSkip to conversation

NFS: checking for NULL instead of IS_ERR() in nfs_commit_file()

PATCH New Dan Carpenter 1 participant 1 message May 23, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NFS: checking for NULL instead of IS_ERR() in nfs_commit_file()

nfs_create_request() doesn't return NULL, it returns error pointers.

Fixes 67911c8f18b5 ('NFS: Add nfs_commit_file()')
fs/nfs/write.c +2 -2
index 4dac51b..54a4eb6 100644
@@ -1735,8 +1735,8 @@ int nfs_commit_file(struct file *file, struct nfs_write_verifier *verf)
 
 	open = get_nfs_open_context(nfs_file_open_context(file));
 	req  = nfs_create_request(open, NULL, NULL, 0, i_size_read(inode));
-	if (!req) {
-		ret = -ENOMEM;
+	if (IS_ERR(req)) {
+		ret = PTR_ERR(req);
 		goto out_put;
 	}