cifs: clean up some compiler warnings
Subsystems (2)
PATCH 1/1 cifs: clean up some compiler warnings
New compiler warnings that I noticed when building a patchset based on recent Fedora kernel:
fs/cifs/cifssmb.c: In function ‘CIFSSMBSetFileSize’:fs/cifs/cifssmb.c:4813:8: warning: variable ‘data_offset’ set but not used [-Wunused-but-set-variable]
fs/cifs/file.c: In function ‘cifs_open’:fs/cifs/file.c:349:24: warning: variable ‘pCifsInode’ set but not used [-Wunused-but-set-variable]fs/cifs/file.c: In function ‘cifs_partialpagewrite’:fs/cifs/file.c:1149:23: warning: variable ‘cifs_sb’ set but not used [-Wunused-but-set-variable]fs/cifs/file.c: In function ‘cifs_iovec_write’:fs/cifs/file.c:1740:9: warning: passing argument 6 of ‘CIFSSMBWrite2’ from incompatible pointer type [enabled by default] fs/cifs/cifsproto.h:337:12: note: expected ‘unsigned int *’ but argument is of type ‘size_t *’
fs/cifs/readdir.c: In function ‘cifs_readdir’:fs/cifs/readdir.c:767:23: warning: variable ‘cifs_sb’ set but not used [-Wunused-but-set-variable]
fs/cifs/cifs_dfs_ref.c: In function ‘cifs_dfs_d_automount’:fs/cifs/cifs_dfs_ref.c:342:2: warning: ‘rc’ may be used uninitialized in this function [-Wuninitialized] fs/cifs/cifs_dfs_ref.c:278:6: note: ‘rc’ was declared here
--- fs/cifs/cifs_dfs_ref.c | 9 ++++----- fs/cifs/cifssmb.c | 3 --- fs/cifs/file.c | 8 ++------ fs/cifs/readdir.c | 3 --- 4 files changed, 6 insertions(+), 17 deletions(-)
fs/cifs/cifs_dfs_ref.c +4 -5
@@ -282,8 +282,6 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt)cFYI (1 ,"in %s" , __func__);BUG_ON (IS_ROOT (mntpt)); - xid =GetXid (); -/* * The MSDFS spec states that paths in DFS referral requests and * responses must be prefixed by a single '\' character instead of
@@ -293,7 +291,7 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt) mnt =ERR_PTR (-ENOMEM ); full_path =build_path_from_dentry (mntpt);if (full_path ==NULL ) - goto free_xid; + goto cdda_exit; cifs_sb =CIFS_SB (mntpt->d_inode->i_sb); tlink =cifs_sb_tlink (cifs_sb);
@@ -303,9 +301,11 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt) } ses =tlink_tcon (tlink)->ses; + xid =GetXid (); rc =get_dfs_path (xid, ses, full_path +1 , cifs_sb->local_nls, &num_referrals, &referrals, cifs_sb->mnt_cifs_flags &CIFS_MOUNT_MAP_SPECIAL_CHR ); +FreeXid (xid);cifs_put_tlink (tlink);
@@ -338,8 +338,7 @@ success:free_dfs_info_array (referrals, num_referrals); free_full_path:kfree (full_path); -free_xid: -FreeXid (xid); +cdda_exit:cFYI (1 ,"leaving %s" , __func__);return mnt; }
fs/cifs/cifssmb.c +0 -3
@@ -4810,7 +4810,6 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size, __u16 fid, __u32 pid_of_opener, bool SetAllocation) { struct smb_com_transaction2_sfi_req *pSMB = NULL; -char *data_offset;struct file_end_of_file_info *parm_data;int rc =0 ;__u16 params, param_offset, offset, byte_count, count;
@@ -4834,8 +4833,6 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size, param_offset = offsetof(struct smb_com_transaction2_sfi_req , Fid) -4 ; offset = param_offset + params; - data_offset = (char *) (&pSMB->hdr.Protocol) + offset; - count =sizeof (struct file_end_of_file_info ); pSMB->MaxParameterCount =cpu_to_le16 (2 );/* BB find exact max SMB PDU from sess structure BB */
fs/cifs/file.c +2 -6
@@ -346,7 +346,6 @@ int cifs_open(struct inode *inode, struct file *file)struct cifsTconInfo *tcon;struct tcon_link *tlink;struct cifsFileInfo *pCifsFile =NULL ; -struct cifsInodeInfo *pCifsInode;char *full_path =NULL ;bool posix_open_ok = false;__u16 netfid;
@@ -361,8 +360,6 @@ int cifs_open(struct inode *inode, struct file *file) } tcon =tlink_tcon (tlink); - pCifsInode =CIFS_I (file->f_path.dentry->d_inode); - full_path =build_path_from_dentry (file->f_path.dentry);if (full_path ==NULL ) { rc = -ENOMEM ;
@@ -1146,7 +1143,6 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)char *write_data;int rc = -EFAULT ;int bytes_written =0 ; -struct cifs_sb_info *cifs_sb;struct inode *inode;struct cifsFileInfo *open_file;
@@ -1154,7 +1150,6 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)return -EFAULT ; inode = page->mapping->host; - cifs_sb =CIFS_SB (inode->i_sb); offset += (loff_t )from; write_data =kmap (page);
@@ -1667,7 +1662,8 @@ static ssize_t cifs_iovec_write(struct file *file, const struct iovec *iov, unsigned long nr_segs, loff_t *poffset) { - size_t total_written = 0, written = 0; + size_t total_written = 0; +unsigned int written =0 ;unsigned long num_pages, npages;size_t copied, len, cur_len, i;struct kvec *to_send;
fs/cifs/readdir.c +0 -3
@@ -764,7 +764,6 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) {int rc =0 ;int xid, i; -struct cifs_sb_info *cifs_sb;struct cifsTconInfo *pTcon;struct cifsFileInfo *cifsFile =NULL ;char *current_entry;
@@ -775,8 +774,6 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) xid =GetXid (); - cifs_sb =CIFS_SB (file->f_path.dentry->d_sb); -/* * Ensure FindFirst doesn't fail before doing filldir() for '.' and * '..'. Otherwise we won't be able to notify VFS in case of failure.
Signature · 1 line
1.7.3.4
A message that is not in the archive (sent off-list or not yet received): 1295968605-21687-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Pavel Shilovsky
Reviewed-by2011/1/25 Jeff Layton <[email protected]>:
Quoted 172 lines
New compiler warnings that I noticed when building a patchset based on recent Fedora kernel:
fs/cifs/cifssmb.c: In function ‘CIFSSMBSetFileSize’:fs/cifs/cifssmb.c:4813:8: warning: variable ‘data_offset’ set but not used [-Wunused-but-set-variable]
fs/cifs/file.c: In function ‘cifs_open’:fs/cifs/file.c:349:24: warning: variable ‘pCifsInode’ set but not used [-Wunused-but-set-variable]fs/cifs/file.c: In function ‘cifs_partialpagewrite’:fs/cifs/file.c:1149:23: warning: variable ‘cifs_sb’ set but not used [-Wunused-but-set-variable]fs/cifs/file.c: In function ‘cifs_iovec_write’:fs/cifs/file.c:1740:9: warning: passing argument 6 of ‘CIFSSMBWrite2’ from incompatible pointer type [enabled by default]fs/cifs/cifsproto.h:337:12: note: expected ‘unsigned int *’ but argument is of type ‘size_t *’
fs/cifs/readdir.c: In function ‘cifs_readdir’:fs/cifs/readdir.c:767:23: warning: variable ‘cifs_sb’ set but not used [-Wunused-but-set-variable]
fs/cifs/cifs_dfs_ref.c: In function ‘cifs_dfs_d_automount’:fs/cifs/cifs_dfs_ref.c:342:2: warning: ‘rc’ may be used uninitialized in this function [-Wuninitialized]fs/cifs/cifs_dfs_ref.c:278:6: note: ‘rc’ was declared hereSigned-off-by Jeff Layton <[email protected]>---
fs/cifs/cifs_dfs_ref.c | 9 ++++-----
fs/cifs/cifssmb.c | 3 ---
fs/cifs/file.c | 8 ++------
fs/cifs/readdir.c | 3 ---4 files changed, 6 insertions(+), 17 deletions(-)fs/cifs/cifs_dfs_ref.c +3
-3@@ -282,8 +282,6 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt) cFYI(1, "in %s", __func__); BUG_ON(IS_ROOT(mntpt)); - xid = GetXid(); - /** The MSDFS spec states that paths in DFS referral requests and * responses must be prefixed by a single '\' character instead of @@ -293,7 +291,7 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt) mnt = ERR_PTR(-ENOMEM); full_path = build_path_from_dentry(mntpt); if (full_path == NULL) - goto free_xid; + goto cdda_exit; cifs_sb = CIFS_SB(mntpt->d_inode->i_sb); tlink = cifs_sb_tlink(cifs_sb);@@ -303,9 +301,11 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt) } ses = tlink_tcon(tlink)->ses; + xid = GetXid(); rc = get_dfs_path(xid, ses, full_path + 1, cifs_sb->local_nls, &num_referrals, &referrals, cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); + FreeXid(xid); cifs_put_tlink(tlink);@@ -338,8 +338,7 @@ success: free_dfs_info_array(referrals, num_referrals);free_full_path:
kfree(full_path);fs/cifs/cifs_dfs_ref.c +1
-2-free_xid: - FreeXid(xid); +cdda_exit:cFYI(1, "leaving %s" ,
__func__);
return mnt;
}fs/cifs/cifssmb.c +0
-3@@ -4810,7 +4810,6 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size, __u16 fid, __u32 pid_of_opener, bool SetAllocation) { struct smb_com_transaction2_sfi_req *pSMB = NULL; - char *data_offset; struct file_end_of_file_info *parm_data; int rc = 0; __u16 params, param_offset, offset, byte_count, count;@@ -4834,8 +4833,6 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size, param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4; offset = param_offset + params; - data_offset = (char *) (&pSMB->hdr.Protocol) + offset; - count = sizeof(struct file_end_of_file_info); pSMB->MaxParameterCount = cpu_to_le16(2); /* BB find exact max SMB PDU from sess structure BB */fs/cifs/file.c +2
-6@@ -346,7 +346,6 @@ int cifs_open(struct inode *inode, struct file *file) struct cifsTconInfo *tcon; struct tcon_link *tlink; struct cifsFileInfo *pCifsFile = NULL; - struct cifsInodeInfo *pCifsInode; char *full_path = NULL; bool posix_open_ok = false; __u16 netfid;@@ -361,8 +360,6 @@ int cifs_open(struct inode *inode, struct file *file) } tcon = tlink_tcon(tlink); - pCifsInode = CIFS_I(file->f_path.dentry->d_inode); - full_path = build_path_from_dentry(file->f_path.dentry); if (full_path == NULL) { rc = -ENOMEM;@@ -1146,7 +1143,6 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to) char *write_data; int rc = -EFAULT; int bytes_written = 0; - struct cifs_sb_info *cifs_sb; struct inode *inode; struct cifsFileInfo *open_file;@@ -1154,7 +1150,6 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to) return -EFAULT; inode = page->mapping->host; - cifs_sb = CIFS_SB(inode->i_sb); offset += (loff_t)from; write_data = kmap(page);@@ -1667,7 +1662,8 @@ static ssize_t cifs_iovec_write(struct file *file, const struct iovec *iov, unsigned long nr_segs, loff_t *poffset) { - size_t total_written = 0, written = 0; + size_t total_written = 0; + unsigned int written = 0; unsigned long num_pages, npages; size_t copied, len, cur_len, i; struct kvec *to_send;fs/cifs/readdir.c +0
-4@@ -764,7 +764,6 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) { int rc = 0; int xid, i; - struct cifs_sb_info *cifs_sb; struct cifsTconInfo *pTcon; struct cifsFileInfo *cifsFile = NULL; char *current_entry;@@ -775,8 +774,6 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) xid = GetXid(); - cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); - /** Ensure FindFirst doesn't fail before doing filldir() for '.' and * '..'. Otherwise we won't be able to notify VFS in case of failure. -- 1.7.3.4
Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Best regards, Pavel Shilovsky.
A message that is not in the archive (sent off-list or not yet received): AANLkTim+EXv36df1SpKPGxE0ruyWK=3iBW57QpjUyv8e-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
I merged Jeff's updated version of this patch (patch description was altered to remove quotes which threw off git web).
Quoted 186 lines · Pavel Shilovsky
2011/1/25 Jeff Layton <[email protected]>:
Quoted 172 lines
New compiler warnings that I noticed when building a patchset based on recent Fedora kernel:
fs/cifs/cifssmb.c: In function ‘CIFSSMBSetFileSize’:fs/cifs/cifssmb.c:4813:8: warning: variable ‘data_offset’ set but not used [-Wunused-but-set-variable]
fs/cifs/file.c: In function ‘cifs_open’:fs/cifs/file.c:349:24: warning: variable ‘pCifsInode’ set but not used [-Wunused-but-set-variable]fs/cifs/file.c: In function ‘cifs_partialpagewrite’:fs/cifs/file.c:1149:23: warning: variable ‘cifs_sb’ set but not used [-Wunused-but-set-variable]fs/cifs/file.c: In function ‘cifs_iovec_write’:fs/cifs/file.c:1740:9: warning: passing argument 6 of ‘CIFSSMBWrite2’ from incompatible pointer type [enabled by default]fs/cifs/cifsproto.h:337:12: note: expected ‘unsigned int *’ but argument is of type ‘size_t *’
fs/cifs/readdir.c: In function ‘cifs_readdir’:fs/cifs/readdir.c:767:23: warning: variable ‘cifs_sb’ set but not used [-Wunused-but-set-variable]
fs/cifs/cifs_dfs_ref.c: In function ‘cifs_dfs_d_automount’:fs/cifs/cifs_dfs_ref.c:342:2: warning: ‘rc’ may be used uninitialized in this function [-Wuninitialized]fs/cifs/cifs_dfs_ref.c:278:6: note: ‘rc’ was declared hereSigned-off-by Jeff Layton <[email protected]>---
fs/cifs/cifs_dfs_ref.c | 9 ++++-----
fs/cifs/cifssmb.c | 3 ---
fs/cifs/file.c | 8 ++------
fs/cifs/readdir.c | 3 ---4 files changed, 6 insertions(+), 17 deletions(-)fs/cifs/cifs_dfs_ref.c +3
-3@@ -282,8 +282,6 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt) cFYI(1, "in %s", __func__); BUG_ON(IS_ROOT(mntpt)); - xid = GetXid(); - /** The MSDFS spec states that paths in DFS referral requests and * responses must be prefixed by a single '\' character instead of @@ -293,7 +291,7 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt) mnt = ERR_PTR(-ENOMEM); full_path = build_path_from_dentry(mntpt); if (full_path == NULL) - goto free_xid; + goto cdda_exit; cifs_sb = CIFS_SB(mntpt->d_inode->i_sb); tlink = cifs_sb_tlink(cifs_sb);@@ -303,9 +301,11 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt) } ses = tlink_tcon(tlink)->ses; + xid = GetXid(); rc = get_dfs_path(xid, ses, full_path + 1, cifs_sb->local_nls, &num_referrals, &referrals, cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); + FreeXid(xid); cifs_put_tlink(tlink);@@ -338,8 +338,7 @@ success: free_dfs_info_array(referrals, num_referrals);free_full_path:
kfree(full_path);fs/cifs/cifs_dfs_ref.c +1
-2-free_xid: - FreeXid(xid); +cdda_exit:cFYI(1, "leaving %s" ,
__func__);
return mnt;
}fs/cifs/cifssmb.c +0
-3@@ -4810,7 +4810,6 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size, __u16 fid, __u32 pid_of_opener, bool SetAllocation) { struct smb_com_transaction2_sfi_req *pSMB = NULL; - char *data_offset; struct file_end_of_file_info *parm_data; int rc = 0; __u16 params, param_offset, offset, byte_count, count;@@ -4834,8 +4833,6 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size, param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4; offset = param_offset + params; - data_offset = (char *) (&pSMB->hdr.Protocol) + offset; - count = sizeof(struct file_end_of_file_info); pSMB->MaxParameterCount = cpu_to_le16(2); /* BB find exact max SMB PDU from sess structure BB */fs/cifs/file.c +2
-6@@ -346,7 +346,6 @@ int cifs_open(struct inode *inode, struct file *file) struct cifsTconInfo *tcon; struct tcon_link *tlink; struct cifsFileInfo *pCifsFile = NULL; - struct cifsInodeInfo *pCifsInode; char *full_path = NULL; bool posix_open_ok = false; __u16 netfid;@@ -361,8 +360,6 @@ int cifs_open(struct inode *inode, struct file *file) } tcon = tlink_tcon(tlink); - pCifsInode = CIFS_I(file->f_path.dentry->d_inode); - full_path = build_path_from_dentry(file->f_path.dentry); if (full_path == NULL) { rc = -ENOMEM;@@ -1146,7 +1143,6 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to) char *write_data; int rc = -EFAULT; int bytes_written = 0; - struct cifs_sb_info *cifs_sb; struct inode *inode; struct cifsFileInfo *open_file;@@ -1154,7 +1150,6 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to) return -EFAULT; inode = page->mapping->host; - cifs_sb = CIFS_SB(inode->i_sb); offset += (loff_t)from; write_data = kmap(page);@@ -1667,7 +1662,8 @@ static ssize_t cifs_iovec_write(struct file *file, const struct iovec *iov, unsigned long nr_segs, loff_t *poffset) { - size_t total_written = 0, written = 0; + size_t total_written = 0; + unsigned int written = 0; unsigned long num_pages, npages; size_t copied, len, cur_len, i; struct kvec *to_send;fs/cifs/readdir.c +0
-4@@ -764,7 +764,6 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) { int rc = 0; int xid, i; - struct cifs_sb_info *cifs_sb; struct cifsTconInfo *pTcon; struct cifsFileInfo *cifsFile = NULL; char *current_entry;@@ -775,8 +774,6 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) xid = GetXid(); - cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); - /** Ensure FindFirst doesn't fail before doing filldir() for '.' and * '..'. Otherwise we won't be able to notify VFS in case of failure. -- 1.7.3.4
Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.htmlReviewed-by Pavel Shilovsky <[email protected]>--
Best regards,
Pavel Shilovsky.
Signature · 3 lines
Thanks, Steve