]> www.infradead.org Git - users/hch/misc.git/commitdiff
smb: client: remove redudant assignment in cifs_strict_fsync()
authorPaulo Alcantara <pc@manguebit.org>
Thu, 9 Oct 2025 15:41:16 +0000 (12:41 -0300)
committerSteve French <stfrench@microsoft.com>
Thu, 9 Oct 2025 16:16:25 +0000 (11:16 -0500)
Remove redudant assignment of @rc as it will be overwritten by the
following cifs_file_flush() call.

Reported-by: Steve French <stfrench@microsoft.com>
Addresses-Coverity: 1665925
Fixes: 210627b0aca9 ("smb: client: fix missing timestamp updates with O_TRUNC")
Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
Cc: linux-cifs@vger.kernel.org
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/file.c

index ecbb63e665213d07109f347e797de0bb036203d0..474dadeb15933fca117a3c45fabb90d3d0ad7148 100644 (file)
@@ -2754,7 +2754,7 @@ int cifs_strict_fsync(struct file *file, loff_t start, loff_t end,
        struct cifsFileInfo *smbfile = file->private_data;
        struct inode *inode = file_inode(file);
        unsigned int xid;
-       int rc = 0;
+       int rc;
 
        rc = file_write_and_wait_range(file, start, end);
        if (rc) {
@@ -2762,19 +2762,14 @@ int cifs_strict_fsync(struct file *file, loff_t start, loff_t end,
                return rc;
        }
 
-       xid = get_xid();
-
-       cifs_dbg(FYI, "Sync file - name: %pD datasync: 0x%x\n",
-                file, datasync);
+       cifs_dbg(FYI, "%s: name=%pD datasync=0x%x\n", __func__, file, datasync);
 
        if (!CIFS_CACHE_READ(CIFS_I(inode))) {
                rc = cifs_zap_mapping(inode);
-               if (rc) {
-                       cifs_dbg(FYI, "rc: %d during invalidate phase\n", rc);
-                       rc = 0; /* don't care about it in fsync */
-               }
+               cifs_dbg(FYI, "%s: invalidate mapping: rc = %d\n", __func__, rc);
        }
 
+       xid = get_xid();
        rc = cifs_file_flush(xid, inode, smbfile);
        free_xid(xid);
        return rc;