aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/inode.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2009-02-11 08:08:26 -0500
committerSteve French <sfrench@us.ibm.com>2009-02-20 22:37:08 -0500
commit950ec52880fab89b957c7dc45e8b8476dd63741f (patch)
treedfb8bd4bdf0e455fefd453c4e899276641a60394 /fs/cifs/inode.c
parent132ac7b77cc95a22d6118d327c96586759fbf006 (diff)
cifs: properly handle case where CIFSGetSrvInodeNumber fails
...if it does then we pass a pointer to an unintialized variable for the inode number to cifs_new_inode. Have it pass a NULL pointer instead. Also tweak the function prototypes to reduce the amount of casting. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/inode.c')
-rw-r--r--fs/cifs/inode.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index c7674f595ad..475115c7cc7 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -213,7 +213,7 @@ static void fill_fake_finddataunix(FILE_UNIX_BASIC_INFO *pfnd_dat,
213 * guaranteed to be unique. 213 * guaranteed to be unique.
214 */ 214 */
215struct inode * 215struct inode *
216cifs_new_inode(struct super_block *sb, unsigned long *inum) 216cifs_new_inode(struct super_block *sb, __u64 *inum)
217{ 217{
218 struct inode *inode; 218 struct inode *inode;
219 219
@@ -228,7 +228,7 @@ cifs_new_inode(struct super_block *sb, unsigned long *inum)
228 * if serverino is disabled, perhaps we should be using iunique()? 228 * if serverino is disabled, perhaps we should be using iunique()?
229 */ 229 */
230 if (inum && (CIFS_SB(sb)->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)) 230 if (inum && (CIFS_SB(sb)->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM))
231 inode->i_ino = *inum; 231 inode->i_ino = (unsigned long) *inum;
232 232
233 /* 233 /*
234 * must set this here instead of cifs_alloc_inode since VFS will 234 * must set this here instead of cifs_alloc_inode since VFS will
@@ -276,8 +276,7 @@ int cifs_get_inode_info_unix(struct inode **pinode,
276 276
277 /* get new inode */ 277 /* get new inode */
278 if (*pinode == NULL) { 278 if (*pinode == NULL) {
279 *pinode = cifs_new_inode(sb, (unsigned long *) 279 *pinode = cifs_new_inode(sb, &find_data.UniqueId);
280 &find_data.UniqueId);
281 if (*pinode == NULL) { 280 if (*pinode == NULL) {
282 rc = -ENOMEM; 281 rc = -ENOMEM;
283 goto cgiiu_exit; 282 goto cgiiu_exit;
@@ -499,6 +498,7 @@ int cifs_get_inode_info(struct inode **pinode,
499 /* get new inode */ 498 /* get new inode */
500 if (*pinode == NULL) { 499 if (*pinode == NULL) {
501 __u64 inode_num; 500 __u64 inode_num;
501 __u64 *pinum = &inode_num;
502 502
503 /* Is an i_ino of zero legal? Can we use that to check 503 /* Is an i_ino of zero legal? Can we use that to check
504 if the server supports returning inode numbers? Are 504 if the server supports returning inode numbers? Are
@@ -518,20 +518,20 @@ int cifs_get_inode_info(struct inode **pinode,
518 int rc1 = 0; 518 int rc1 = 0;
519 519
520 rc1 = CIFSGetSrvInodeNumber(xid, pTcon, 520 rc1 = CIFSGetSrvInodeNumber(xid, pTcon,
521 full_path, &inode_num, 521 full_path, pinum,
522 cifs_sb->local_nls, 522 cifs_sb->local_nls,
523 cifs_sb->mnt_cifs_flags & 523 cifs_sb->mnt_cifs_flags &
524 CIFS_MOUNT_MAP_SPECIAL_CHR); 524 CIFS_MOUNT_MAP_SPECIAL_CHR);
525 if (rc1) { 525 if (rc1) {
526 cFYI(1, ("GetSrvInodeNum rc %d", rc1)); 526 cFYI(1, ("GetSrvInodeNum rc %d", rc1));
527 pinum = NULL;
527 /* BB EOPNOSUPP disable SERVER_INUM? */ 528 /* BB EOPNOSUPP disable SERVER_INUM? */
528 } 529 }
529 *pinode = cifs_new_inode(sb, (unsigned long *)
530 &inode_num);
531 } else { 530 } else {
532 *pinode = cifs_new_inode(sb, NULL); 531 pinum = NULL;
533 } 532 }
534 533
534 *pinode = cifs_new_inode(sb, pinum);
535 if (*pinode == NULL) { 535 if (*pinode == NULL) {
536 rc = -ENOMEM; 536 rc = -ENOMEM;
537 goto cgii_exit; 537 goto cgii_exit;
@@ -1148,8 +1148,8 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
1148 else 1148 else
1149 direntry->d_op = &cifs_dentry_ops; 1149 direntry->d_op = &cifs_dentry_ops;
1150 1150
1151 newinode = cifs_new_inode(inode->i_sb, (unsigned long *) 1151 newinode = cifs_new_inode(inode->i_sb,
1152 &pInfo->UniqueId); 1152 &pInfo->UniqueId);
1153 if (newinode == NULL) { 1153 if (newinode == NULL) {
1154 kfree(pInfo); 1154 kfree(pInfo);
1155 goto mkdir_get_info; 1155 goto mkdir_get_info;