Skip to contentSkip to conversation

cifs: Fix undefined variables

PATCH In review David Howells 2 participants 2 messages May 18 – May 19

Subsystems (4)
lore
Share & tools
lore

David Howells

author maintainer
#0 lore raw

PATCH 1/1 cifs: Fix undefined variables

Fix a couple of undefined variables introduced by the patch to fix tearing on ->remote_i_size and ->zero_point. For some reason, make W=1 with gcc doesn't give undefined variable warnings (but clang does).

Fixes 2c8f4742bb76 ("netfs: Fix potential for tearing in ->remote_i_size and ->zero_point")
cc Steve French <[email protected]>
cc Paulo Alcantara <[email protected]>
cc Matthew Wilcox <[email protected]>
cc Christian Brauner <[email protected]>
---
 fs/smb/client/cifsfs.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/smb/client/cifsfs.c +3 -3
index feac491c5070..f557eb7875c7 100644
@@ -1304,7 +1304,7 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off,
 	struct cifsFileInfo *smb_file_src = src_file->private_data;
 	struct cifsFileInfo *smb_file_target = dst_file->private_data;
 	struct cifs_tcon *target_tcon, *src_tcon;
-	unsigned long long i_size, old_size, new_size, zero_point;
+	unsigned long long i_size, new_size;
 	unsigned long long destend, fstart, fend;
 	unsigned int xid;
 	int rc;
@@ -1372,7 +1372,7 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off,
 		goto unlock;
 
 	spin_lock(&target_inode->i_lock);
-	if (fend > zero_point)
+	if (fend > target_cifsi->netfs._zero_point)
 		netfs_write_zero_point(target_inode, fend + 1);
 	i_size = target_inode->i_size;
 	spin_unlock(&target_inode->i_lock);
@@ -1387,7 +1387,7 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off,
 	if (target_tcon->ses->server->ops->duplicate_extents) {
 		rc = target_tcon->ses->server->ops->duplicate_extents(xid,
 			smb_file_src, smb_file_target, off, len, destoff);
-		if (rc == 0 && new_size > old_size) {
+		if (rc == 0 && new_size > i_size) {
 			truncate_setsize(target_inode, new_size);
 			fscache_resize_cookie(cifs_inode_cookie(target_inode),
 					      new_size);
#1 lore raw
Quoted 3 lines · David Howells

Fix a couple of undefined variables introduced by the patch to fix tearing on ->remote_i_size and ->zero_point.

Applied directly.

Linus