diff options
Diffstat (limited to 'fs/configfs')
-rw-r--r-- | fs/configfs/configfs_internal.h | 4 | ||||
-rw-r--r-- | fs/configfs/dir.c | 5 | ||||
-rw-r--r-- | fs/configfs/file.c | 9 | ||||
-rw-r--r-- | fs/configfs/inode.c | 2 | ||||
-rw-r--r-- | fs/configfs/mount.c | 2 | ||||
-rw-r--r-- | fs/configfs/symlink.c | 2 |
6 files changed, 13 insertions, 11 deletions
diff --git a/fs/configfs/configfs_internal.h b/fs/configfs/configfs_internal.h index f92cd303d2c9..7b48c034b312 100644 --- a/fs/configfs/configfs_internal.h +++ b/fs/configfs/configfs_internal.h | |||
@@ -75,8 +75,8 @@ extern struct super_block * configfs_sb; | |||
75 | extern const struct file_operations configfs_dir_operations; | 75 | extern const struct file_operations configfs_dir_operations; |
76 | extern const struct file_operations configfs_file_operations; | 76 | extern const struct file_operations configfs_file_operations; |
77 | extern const struct file_operations bin_fops; | 77 | extern const struct file_operations bin_fops; |
78 | extern struct inode_operations configfs_dir_inode_operations; | 78 | extern const struct inode_operations configfs_dir_inode_operations; |
79 | extern struct inode_operations configfs_symlink_inode_operations; | 79 | extern const struct inode_operations configfs_symlink_inode_operations; |
80 | 80 | ||
81 | extern int configfs_symlink(struct inode *dir, struct dentry *dentry, | 81 | extern int configfs_symlink(struct inode *dir, struct dentry *dentry, |
82 | const char *symname); | 82 | const char *symname); |
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 1814ba446809..34750d5e4ff2 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c | |||
@@ -72,11 +72,10 @@ static struct configfs_dirent *configfs_new_dirent(struct configfs_dirent * pare | |||
72 | { | 72 | { |
73 | struct configfs_dirent * sd; | 73 | struct configfs_dirent * sd; |
74 | 74 | ||
75 | sd = kmem_cache_alloc(configfs_dir_cachep, GFP_KERNEL); | 75 | sd = kmem_cache_zalloc(configfs_dir_cachep, GFP_KERNEL); |
76 | if (!sd) | 76 | if (!sd) |
77 | return NULL; | 77 | return NULL; |
78 | 78 | ||
79 | memset(sd, 0, sizeof(*sd)); | ||
80 | atomic_set(&sd->s_count, 1); | 79 | atomic_set(&sd->s_count, 1); |
81 | INIT_LIST_HEAD(&sd->s_links); | 80 | INIT_LIST_HEAD(&sd->s_links); |
82 | INIT_LIST_HEAD(&sd->s_children); | 81 | INIT_LIST_HEAD(&sd->s_children); |
@@ -931,7 +930,7 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
931 | return 0; | 930 | return 0; |
932 | } | 931 | } |
933 | 932 | ||
934 | struct inode_operations configfs_dir_inode_operations = { | 933 | const struct inode_operations configfs_dir_inode_operations = { |
935 | .mkdir = configfs_mkdir, | 934 | .mkdir = configfs_mkdir, |
936 | .rmdir = configfs_rmdir, | 935 | .rmdir = configfs_rmdir, |
937 | .symlink = configfs_symlink, | 936 | .symlink = configfs_symlink, |
diff --git a/fs/configfs/file.c b/fs/configfs/file.c index 2a7cb086e80c..d98be5e01328 100644 --- a/fs/configfs/file.c +++ b/fs/configfs/file.c | |||
@@ -162,14 +162,17 @@ fill_write_buffer(struct configfs_buffer * buffer, const char __user * buf, size | |||
162 | int error; | 162 | int error; |
163 | 163 | ||
164 | if (!buffer->page) | 164 | if (!buffer->page) |
165 | buffer->page = (char *)get_zeroed_page(GFP_KERNEL); | 165 | buffer->page = (char *)__get_free_pages(GFP_KERNEL, 0); |
166 | if (!buffer->page) | 166 | if (!buffer->page) |
167 | return -ENOMEM; | 167 | return -ENOMEM; |
168 | 168 | ||
169 | if (count > PAGE_SIZE) | 169 | if (count >= PAGE_SIZE) |
170 | count = PAGE_SIZE; | 170 | count = PAGE_SIZE - 1; |
171 | error = copy_from_user(buffer->page,buf,count); | 171 | error = copy_from_user(buffer->page,buf,count); |
172 | buffer->needs_read_fill = 1; | 172 | buffer->needs_read_fill = 1; |
173 | /* if buf is assumed to contain a string, terminate it by \0, | ||
174 | * so e.g. sscanf() can scan the string easily */ | ||
175 | buffer->page[count] = 0; | ||
173 | return error ? -EFAULT : count; | 176 | return error ? -EFAULT : count; |
174 | } | 177 | } |
175 | 178 | ||
diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c index fb18917954a9..2ec9beac17cf 100644 --- a/fs/configfs/inode.c +++ b/fs/configfs/inode.c | |||
@@ -49,7 +49,7 @@ static struct backing_dev_info configfs_backing_dev_info = { | |||
49 | .capabilities = BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK, | 49 | .capabilities = BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK, |
50 | }; | 50 | }; |
51 | 51 | ||
52 | static struct inode_operations configfs_inode_operations ={ | 52 | static const struct inode_operations configfs_inode_operations ={ |
53 | .setattr = configfs_setattr, | 53 | .setattr = configfs_setattr, |
54 | }; | 54 | }; |
55 | 55 | ||
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c index ed678529ebb2..6f573004cd7d 100644 --- a/fs/configfs/mount.c +++ b/fs/configfs/mount.c | |||
@@ -41,7 +41,7 @@ struct super_block * configfs_sb = NULL; | |||
41 | struct kmem_cache *configfs_dir_cachep; | 41 | struct kmem_cache *configfs_dir_cachep; |
42 | static int configfs_mnt_count = 0; | 42 | static int configfs_mnt_count = 0; |
43 | 43 | ||
44 | static struct super_operations configfs_ops = { | 44 | static const struct super_operations configfs_ops = { |
45 | .statfs = simple_statfs, | 45 | .statfs = simple_statfs, |
46 | .drop_inode = generic_delete_inode, | 46 | .drop_inode = generic_delete_inode, |
47 | }; | 47 | }; |
diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c index fb65e0800a86..22700d2857da 100644 --- a/fs/configfs/symlink.c +++ b/fs/configfs/symlink.c | |||
@@ -272,7 +272,7 @@ static void configfs_put_link(struct dentry *dentry, struct nameidata *nd, | |||
272 | } | 272 | } |
273 | } | 273 | } |
274 | 274 | ||
275 | struct inode_operations configfs_symlink_inode_operations = { | 275 | const struct inode_operations configfs_symlink_inode_operations = { |
276 | .follow_link = configfs_follow_link, | 276 | .follow_link = configfs_follow_link, |
277 | .readlink = generic_readlink, | 277 | .readlink = generic_readlink, |
278 | .put_link = configfs_put_link, | 278 | .put_link = configfs_put_link, |