Commit 44db77f33cc42c49f55ddb360f5e9a05581ffdc0
Committed by
Linus Torvalds
1 parent
69c99ac17e
Exists in
master
and in
39 other branches
[PATCH] ncpfs: remove kmalloc wrapper
Remove remaining kmalloc wrapper bits from fs/ncpfs/. Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 3 changed files with 13 additions and 54 deletions Side-by-side Diff
fs/ncpfs/inode.c
... | ... | @@ -716,10 +716,8 @@ |
716 | 716 | fput(server->ncp_filp); |
717 | 717 | kill_proc(server->m.wdog_pid, SIGTERM, 1); |
718 | 718 | |
719 | - if (server->priv.data) | |
720 | - ncp_kfree_s(server->priv.data, server->priv.len); | |
721 | - if (server->auth.object_name) | |
722 | - ncp_kfree_s(server->auth.object_name, server->auth.object_name_len); | |
719 | + kfree(server->priv.data); | |
720 | + kfree(server->auth.object_name); | |
723 | 721 | vfree(server->packet); |
724 | 722 | sb->s_fs_info = NULL; |
725 | 723 | kfree(server); |
... | ... | @@ -958,11 +956,6 @@ |
958 | 956 | return result; |
959 | 957 | } |
960 | 958 | |
961 | -#ifdef DEBUG_NCP_MALLOC | |
962 | -int ncp_malloced; | |
963 | -int ncp_current_malloced; | |
964 | -#endif | |
965 | - | |
966 | 959 | static struct super_block *ncp_get_sb(struct file_system_type *fs_type, |
967 | 960 | int flags, const char *dev_name, void *data) |
968 | 961 | { |
... | ... | @@ -981,10 +974,6 @@ |
981 | 974 | int err; |
982 | 975 | DPRINTK("ncpfs: init_module called\n"); |
983 | 976 | |
984 | -#ifdef DEBUG_NCP_MALLOC | |
985 | - ncp_malloced = 0; | |
986 | - ncp_current_malloced = 0; | |
987 | -#endif | |
988 | 977 | err = init_inodecache(); |
989 | 978 | if (err) |
990 | 979 | goto out1; |
... | ... | @@ -1003,10 +992,6 @@ |
1003 | 992 | DPRINTK("ncpfs: cleanup_module called\n"); |
1004 | 993 | unregister_filesystem(&ncp_fs_type); |
1005 | 994 | destroy_inodecache(); |
1006 | -#ifdef DEBUG_NCP_MALLOC | |
1007 | - PRINTK("ncp_malloced: %d\n", ncp_malloced); | |
1008 | - PRINTK("ncp_current_malloced: %d\n", ncp_current_malloced); | |
1009 | -#endif | |
1010 | 995 | } |
1011 | 996 | |
1012 | 997 | module_init(init_ncp_fs) |
fs/ncpfs/ioctl.c
... | ... | @@ -518,10 +518,11 @@ |
518 | 518 | if (user.object_name_len > NCP_OBJECT_NAME_MAX_LEN) |
519 | 519 | return -ENOMEM; |
520 | 520 | if (user.object_name_len) { |
521 | - newname = ncp_kmalloc(user.object_name_len, GFP_USER); | |
522 | - if (!newname) return -ENOMEM; | |
521 | + newname = kmalloc(user.object_name_len, GFP_USER); | |
522 | + if (!newname) | |
523 | + return -ENOMEM; | |
523 | 524 | if (copy_from_user(newname, user.object_name, user.object_name_len)) { |
524 | - ncp_kfree_s(newname, user.object_name_len); | |
525 | + kfree(newname); | |
525 | 526 | return -EFAULT; |
526 | 527 | } |
527 | 528 | } else { |
... | ... | @@ -540,8 +541,8 @@ |
540 | 541 | server->priv.len = 0; |
541 | 542 | server->priv.data = NULL; |
542 | 543 | /* leave critical section */ |
543 | - if (oldprivate) ncp_kfree_s(oldprivate, oldprivatelen); | |
544 | - if (oldname) ncp_kfree_s(oldname, oldnamelen); | |
544 | + kfree(oldprivate); | |
545 | + kfree(oldname); | |
545 | 546 | return 0; |
546 | 547 | } |
547 | 548 | case NCP_IOC_GETPRIVATEDATA: |
548 | 549 | |
... | ... | @@ -581,10 +582,11 @@ |
581 | 582 | if (user.len > NCP_PRIVATE_DATA_MAX_LEN) |
582 | 583 | return -ENOMEM; |
583 | 584 | if (user.len) { |
584 | - new = ncp_kmalloc(user.len, GFP_USER); | |
585 | - if (!new) return -ENOMEM; | |
585 | + new = kmalloc(user.len, GFP_USER); | |
586 | + if (!new) | |
587 | + return -ENOMEM; | |
586 | 588 | if (copy_from_user(new, user.data, user.len)) { |
587 | - ncp_kfree_s(new, user.len); | |
589 | + kfree(new); | |
588 | 590 | return -EFAULT; |
589 | 591 | } |
590 | 592 | } else { |
... | ... | @@ -596,7 +598,7 @@ |
596 | 598 | server->priv.len = user.len; |
597 | 599 | server->priv.data = new; |
598 | 600 | /* leave critical section */ |
599 | - if (old) ncp_kfree_s(old, oldlen); | |
601 | + kfree(old); | |
600 | 602 | return 0; |
601 | 603 | } |
602 | 604 |
include/linux/ncp_fs.h
... | ... | @@ -201,34 +201,6 @@ |
201 | 201 | return container_of(inode, struct ncp_inode_info, vfs_inode); |
202 | 202 | } |
203 | 203 | |
204 | -#ifdef DEBUG_NCP_MALLOC | |
205 | - | |
206 | -#include <linux/slab.h> | |
207 | - | |
208 | -extern int ncp_malloced; | |
209 | -extern int ncp_current_malloced; | |
210 | - | |
211 | -static inline void * | |
212 | - ncp_kmalloc(unsigned int size, int priority) | |
213 | -{ | |
214 | - ncp_malloced += 1; | |
215 | - ncp_current_malloced += 1; | |
216 | - return kmalloc(size, priority); | |
217 | -} | |
218 | - | |
219 | -static inline void ncp_kfree_s(void *obj, int size) | |
220 | -{ | |
221 | - ncp_current_malloced -= 1; | |
222 | - kfree(obj); | |
223 | -} | |
224 | - | |
225 | -#else /* DEBUG_NCP_MALLOC */ | |
226 | - | |
227 | -#define ncp_kmalloc(s,p) kmalloc(s,p) | |
228 | -#define ncp_kfree_s(o,s) kfree(o) | |
229 | - | |
230 | -#endif /* DEBUG_NCP_MALLOC */ | |
231 | - | |
232 | 204 | /* linux/fs/ncpfs/inode.c */ |
233 | 205 | int ncp_notify_change(struct dentry *, struct iattr *); |
234 | 206 | struct inode *ncp_iget(struct super_block *, struct ncp_entry_info *); |