aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/hostfs/hostfs_kern.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 9baf69773ed1..fd301a910122 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -20,7 +20,6 @@
20#include "hostfs.h" 20#include "hostfs.h"
21#include "kern_util.h" 21#include "kern_util.h"
22#include "kern.h" 22#include "kern.h"
23#include "user_util.h"
24#include "init.h" 23#include "init.h"
25 24
26struct hostfs_inode_info { 25struct hostfs_inode_info {
@@ -939,7 +938,7 @@ static const struct address_space_operations hostfs_link_aops = {
939static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent) 938static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
940{ 939{
941 struct inode *root_inode; 940 struct inode *root_inode;
942 char *name, *data = d; 941 char *host_root_path, *req_root = d;
943 int err; 942 int err;
944 943
945 sb->s_blocksize = 1024; 944 sb->s_blocksize = 1024;
@@ -948,16 +947,16 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
948 sb->s_op = &hostfs_sbops; 947 sb->s_op = &hostfs_sbops;
949 948
950 /* NULL is printed as <NULL> by sprintf: avoid that. */ 949 /* NULL is printed as <NULL> by sprintf: avoid that. */
951 if (data == NULL) 950 if (req_root == NULL)
952 data = ""; 951 req_root = "";
953 952
954 err = -ENOMEM; 953 err = -ENOMEM;
955 name = kmalloc(strlen(root_ino) + 1 954 host_root_path = kmalloc(strlen(root_ino) + 1
956 + strlen(data) + 1, GFP_KERNEL); 955 + strlen(req_root) + 1, GFP_KERNEL);
957 if(name == NULL) 956 if(host_root_path == NULL)
958 goto out; 957 goto out;
959 958
960 sprintf(name, "%s/%s", root_ino, data); 959 sprintf(host_root_path, "%s/%s", root_ino, req_root);
961 960
962 root_inode = iget(sb, 0); 961 root_inode = iget(sb, 0);
963 if(root_inode == NULL) 962 if(root_inode == NULL)
@@ -967,10 +966,10 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
967 if(err) 966 if(err)
968 goto out_put; 967 goto out_put;
969 968
970 HOSTFS_I(root_inode)->host_filename = name; 969 HOSTFS_I(root_inode)->host_filename = host_root_path;
971 /* Avoid that in the error path, iput(root_inode) frees again name through 970 /* Avoid that in the error path, iput(root_inode) frees again
972 * hostfs_destroy_inode! */ 971 * host_root_path through hostfs_destroy_inode! */
973 name = NULL; 972 host_root_path = NULL;
974 973
975 err = -ENOMEM; 974 err = -ENOMEM;
976 sb->s_root = d_alloc_root(root_inode); 975 sb->s_root = d_alloc_root(root_inode);
@@ -990,7 +989,7 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
990 out_put: 989 out_put:
991 iput(root_inode); 990 iput(root_inode);
992 out_free: 991 out_free:
993 kfree(name); 992 kfree(host_root_path);
994 out: 993 out:
995 return(err); 994 return(err);
996} 995}