diff options
| author | Panagiotis Issaris <takis@issaris.org> | 2006-09-27 04:49:39 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-27 11:26:10 -0400 |
| commit | f52720ca5f48574e347dff35ffe6b389ace61537 (patch) | |
| tree | 7efc8ec6bad32b98e406a5c553149d57e46bd07e | |
| parent | f8314dc60ccba7e41f425048c4160dc7f63377d5 (diff) | |
[PATCH] fs: Removing useless casts
* Removing useless casts
* Removing useless wrapper
* Conversion from kmalloc+memset to kzalloc
Signed-off-by: Panagiotis Issaris <takis@issaris.org>
Acked-by: Dave Kleikamp <shaggy@austin.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
| -rw-r--r-- | fs/coda/dir.c | 2 | ||||
| -rw-r--r-- | fs/ext2/acl.c | 4 | ||||
| -rw-r--r-- | fs/ext3/acl.c | 4 | ||||
| -rw-r--r-- | fs/ext3/resize.c | 4 | ||||
| -rw-r--r-- | fs/hpfs/buffer.c | 2 | ||||
| -rw-r--r-- | fs/jffs/inode-v23.c | 8 | ||||
| -rw-r--r-- | fs/jffs/intrep.c | 11 | ||||
| -rw-r--r-- | fs/jffs/jffs_fm.c | 6 | ||||
| -rw-r--r-- | fs/jfs/jfs_txnmgr.c | 4 | ||||
| -rw-r--r-- | fs/lockd/clntproc.c | 2 | ||||
| -rw-r--r-- | fs/ncpfs/symlink.c | 4 | ||||
| -rw-r--r-- | fs/nfs/delegation.c | 7 | ||||
| -rw-r--r-- | fs/nfs/inode.c | 2 | ||||
| -rw-r--r-- | fs/nfs/nfs3proc.c | 2 | ||||
| -rw-r--r-- | fs/nfs/proc.c | 2 | ||||
| -rw-r--r-- | fs/ntfs/dir.c | 5 | ||||
| -rw-r--r-- | fs/ntfs/inode.c | 2 | ||||
| -rw-r--r-- | fs/ntfs/mft.c | 4 | ||||
| -rw-r--r-- | fs/ntfs/unistr.c | 4 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_file.c | 2 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.c | 4 |
21 files changed, 37 insertions, 48 deletions
diff --git a/fs/coda/dir.c b/fs/coda/dir.c index 71f2ea632e53..8651ea6a23b7 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c | |||
| @@ -513,7 +513,7 @@ static int coda_venus_readdir(struct file *filp, filldir_t filldir, | |||
| 513 | ino_t ino; | 513 | ino_t ino; |
| 514 | int ret, i; | 514 | int ret, i; |
| 515 | 515 | ||
| 516 | vdir = (struct venus_dirent *)kmalloc(sizeof(*vdir), GFP_KERNEL); | 516 | vdir = kmalloc(sizeof(*vdir), GFP_KERNEL); |
| 517 | if (!vdir) return -ENOMEM; | 517 | if (!vdir) return -ENOMEM; |
| 518 | 518 | ||
| 519 | i = filp->f_pos; | 519 | i = filp->f_pos; |
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c index da52b4a5db64..7c420b800c34 100644 --- a/fs/ext2/acl.c +++ b/fs/ext2/acl.c | |||
| @@ -89,8 +89,8 @@ ext2_acl_to_disk(const struct posix_acl *acl, size_t *size) | |||
| 89 | size_t n; | 89 | size_t n; |
| 90 | 90 | ||
| 91 | *size = ext2_acl_size(acl->a_count); | 91 | *size = ext2_acl_size(acl->a_count); |
| 92 | ext_acl = (ext2_acl_header *)kmalloc(sizeof(ext2_acl_header) + | 92 | ext_acl = kmalloc(sizeof(ext2_acl_header) + acl->a_count * |
| 93 | acl->a_count * sizeof(ext2_acl_entry), GFP_KERNEL); | 93 | sizeof(ext2_acl_entry), GFP_KERNEL); |
| 94 | if (!ext_acl) | 94 | if (!ext_acl) |
| 95 | return ERR_PTR(-ENOMEM); | 95 | return ERR_PTR(-ENOMEM); |
| 96 | ext_acl->a_version = cpu_to_le32(EXT2_ACL_VERSION); | 96 | ext_acl->a_version = cpu_to_le32(EXT2_ACL_VERSION); |
diff --git a/fs/ext3/acl.c b/fs/ext3/acl.c index 92bf78221429..1e5038d9a01b 100644 --- a/fs/ext3/acl.c +++ b/fs/ext3/acl.c | |||
| @@ -90,8 +90,8 @@ ext3_acl_to_disk(const struct posix_acl *acl, size_t *size) | |||
| 90 | size_t n; | 90 | size_t n; |
| 91 | 91 | ||
| 92 | *size = ext3_acl_size(acl->a_count); | 92 | *size = ext3_acl_size(acl->a_count); |
| 93 | ext_acl = (ext3_acl_header *)kmalloc(sizeof(ext3_acl_header) + | 93 | ext_acl = kmalloc(sizeof(ext3_acl_header) + acl->a_count * |
| 94 | acl->a_count * sizeof(ext3_acl_entry), GFP_KERNEL); | 94 | sizeof(ext3_acl_entry), GFP_KERNEL); |
| 95 | if (!ext_acl) | 95 | if (!ext_acl) |
| 96 | return ERR_PTR(-ENOMEM); | 96 | return ERR_PTR(-ENOMEM); |
| 97 | ext_acl->a_version = cpu_to_le32(EXT3_ACL_VERSION); | 97 | ext_acl->a_version = cpu_to_le32(EXT3_ACL_VERSION); |
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c index 9e318a5cfc87..b73cba12f79c 100644 --- a/fs/ext3/resize.c +++ b/fs/ext3/resize.c | |||
| @@ -439,8 +439,8 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, | |||
| 439 | if ((err = ext3_reserve_inode_write(handle, inode, &iloc))) | 439 | if ((err = ext3_reserve_inode_write(handle, inode, &iloc))) |
| 440 | goto exit_dindj; | 440 | goto exit_dindj; |
| 441 | 441 | ||
| 442 | n_group_desc = (struct buffer_head **)kmalloc((gdb_num + 1) * | 442 | n_group_desc = kmalloc((gdb_num + 1) * sizeof(struct buffer_head *), |
| 443 | sizeof(struct buffer_head *), GFP_KERNEL); | 443 | GFP_KERNEL); |
| 444 | if (!n_group_desc) { | 444 | if (!n_group_desc) { |
| 445 | err = -ENOMEM; | 445 | err = -ENOMEM; |
| 446 | ext3_warning (sb, __FUNCTION__, | 446 | ext3_warning (sb, __FUNCTION__, |
diff --git a/fs/hpfs/buffer.c b/fs/hpfs/buffer.c index 2807aa833e62..b52b7381d10f 100644 --- a/fs/hpfs/buffer.c +++ b/fs/hpfs/buffer.c | |||
| @@ -76,7 +76,7 @@ void *hpfs_map_4sectors(struct super_block *s, unsigned secno, struct quad_buffe | |||
| 76 | return NULL; | 76 | return NULL; |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | qbh->data = data = (char *)kmalloc(2048, GFP_NOFS); | 79 | qbh->data = data = kmalloc(2048, GFP_NOFS); |
| 80 | if (!data) { | 80 | if (!data) { |
| 81 | printk("HPFS: hpfs_map_4sectors: out of memory\n"); | 81 | printk("HPFS: hpfs_map_4sectors: out of memory\n"); |
| 82 | goto bail; | 82 | goto bail; |
diff --git a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c index 93068697a9bf..b59553d28d13 100644 --- a/fs/jffs/inode-v23.c +++ b/fs/jffs/inode-v23.c | |||
| @@ -652,7 +652,7 @@ jffs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) | |||
| 652 | lock_kernel(); | 652 | lock_kernel(); |
| 653 | 653 | ||
| 654 | D3({ | 654 | D3({ |
| 655 | char *s = (char *)kmalloc(len + 1, GFP_KERNEL); | 655 | char *s = kmalloc(len + 1, GFP_KERNEL); |
| 656 | memcpy(s, name, len); | 656 | memcpy(s, name, len); |
| 657 | s[len] = '\0'; | 657 | s[len] = '\0'; |
| 658 | printk("jffs_lookup(): dir: 0x%p, name: \"%s\"\n", dir, s); | 658 | printk("jffs_lookup(): dir: 0x%p, name: \"%s\"\n", dir, s); |
| @@ -1173,8 +1173,8 @@ jffs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) | |||
| 1173 | lock_kernel(); | 1173 | lock_kernel(); |
| 1174 | D1({ | 1174 | D1({ |
| 1175 | int len = dentry->d_name.len; | 1175 | int len = dentry->d_name.len; |
| 1176 | char *_name = (char *)kmalloc(len + 1, GFP_KERNEL); | 1176 | char *_name = kmalloc(len + 1, GFP_KERNEL); |
| 1177 | char *_symname = (char *)kmalloc(symname_len + 1, GFP_KERNEL); | 1177 | char *_symname = kmalloc(symname_len + 1, GFP_KERNEL); |
| 1178 | memcpy(_name, dentry->d_name.name, len); | 1178 | memcpy(_name, dentry->d_name.name, len); |
| 1179 | _name[len] = '\0'; | 1179 | _name[len] = '\0'; |
| 1180 | memcpy(_symname, symname, symname_len); | 1180 | memcpy(_symname, symname, symname_len); |
| @@ -1282,7 +1282,7 @@ jffs_create(struct inode *dir, struct dentry *dentry, int mode, | |||
| 1282 | lock_kernel(); | 1282 | lock_kernel(); |
| 1283 | D1({ | 1283 | D1({ |
| 1284 | int len = dentry->d_name.len; | 1284 | int len = dentry->d_name.len; |
| 1285 | char *s = (char *)kmalloc(len + 1, GFP_KERNEL); | 1285 | char *s = kmalloc(len + 1, GFP_KERNEL); |
| 1286 | memcpy(s, dentry->d_name.name, len); | 1286 | memcpy(s, dentry->d_name.name, len); |
| 1287 | s[len] = '\0'; | 1287 | s[len] = '\0'; |
| 1288 | printk("jffs_create(): dir: 0x%p, name: \"%s\"\n", dir, s); | 1288 | printk("jffs_create(): dir: 0x%p, name: \"%s\"\n", dir, s); |
diff --git a/fs/jffs/intrep.c b/fs/jffs/intrep.c index 9000f1effedf..4a543e114970 100644 --- a/fs/jffs/intrep.c +++ b/fs/jffs/intrep.c | |||
| @@ -488,13 +488,11 @@ jffs_create_file(struct jffs_control *c, | |||
| 488 | { | 488 | { |
| 489 | struct jffs_file *f; | 489 | struct jffs_file *f; |
| 490 | 490 | ||
| 491 | if (!(f = (struct jffs_file *)kmalloc(sizeof(struct jffs_file), | 491 | if (!(f = kzalloc(sizeof(*f), GFP_KERNEL))) { |
| 492 | GFP_KERNEL))) { | ||
| 493 | D(printk("jffs_create_file(): Failed!\n")); | 492 | D(printk("jffs_create_file(): Failed!\n")); |
| 494 | return NULL; | 493 | return NULL; |
| 495 | } | 494 | } |
| 496 | no_jffs_file++; | 495 | no_jffs_file++; |
| 497 | memset(f, 0, sizeof(struct jffs_file)); | ||
| 498 | f->ino = raw_inode->ino; | 496 | f->ino = raw_inode->ino; |
| 499 | f->pino = raw_inode->pino; | 497 | f->pino = raw_inode->pino; |
| 500 | f->nlink = raw_inode->nlink; | 498 | f->nlink = raw_inode->nlink; |
| @@ -516,7 +514,7 @@ jffs_create_control(struct super_block *sb) | |||
| 516 | 514 | ||
| 517 | D2(printk("jffs_create_control()\n")); | 515 | D2(printk("jffs_create_control()\n")); |
| 518 | 516 | ||
| 519 | if (!(c = (struct jffs_control *)kmalloc(s, GFP_KERNEL))) { | 517 | if (!(c = kmalloc(s, GFP_KERNEL))) { |
| 520 | goto fail_control; | 518 | goto fail_control; |
| 521 | } | 519 | } |
| 522 | DJM(no_jffs_control++); | 520 | DJM(no_jffs_control++); |
| @@ -524,7 +522,7 @@ jffs_create_control(struct super_block *sb) | |||
| 524 | c->gc_task = NULL; | 522 | c->gc_task = NULL; |
| 525 | c->hash_len = JFFS_HASH_SIZE; | 523 | c->hash_len = JFFS_HASH_SIZE; |
| 526 | s = sizeof(struct list_head) * c->hash_len; | 524 | s = sizeof(struct list_head) * c->hash_len; |
| 527 | if (!(c->hash = (struct list_head *)kmalloc(s, GFP_KERNEL))) { | 525 | if (!(c->hash = kmalloc(s, GFP_KERNEL))) { |
| 528 | goto fail_hash; | 526 | goto fail_hash; |
| 529 | } | 527 | } |
| 530 | DJM(no_hash++); | 528 | DJM(no_hash++); |
| @@ -593,8 +591,7 @@ jffs_add_virtual_root(struct jffs_control *c) | |||
| 593 | D2(printk("jffs_add_virtual_root(): " | 591 | D2(printk("jffs_add_virtual_root(): " |
| 594 | "Creating a virtual root directory.\n")); | 592 | "Creating a virtual root directory.\n")); |
| 595 | 593 | ||
| 596 | if (!(root = (struct jffs_file *)kmalloc(sizeof(struct jffs_file), | 594 | if (!(root = kmalloc(sizeof(struct jffs_file), GFP_KERNEL))) { |
| 597 | GFP_KERNEL))) { | ||
| 598 | return -ENOMEM; | 595 | return -ENOMEM; |
| 599 | } | 596 | } |
| 600 | no_jffs_file++; | 597 | no_jffs_file++; |
diff --git a/fs/jffs/jffs_fm.c b/fs/jffs/jffs_fm.c index 7d8ca1aeace2..29b68d939bd9 100644 --- a/fs/jffs/jffs_fm.c +++ b/fs/jffs/jffs_fm.c | |||
| @@ -94,8 +94,7 @@ jffs_build_begin(struct jffs_control *c, int unit) | |||
| 94 | struct mtd_info *mtd; | 94 | struct mtd_info *mtd; |
| 95 | 95 | ||
| 96 | D3(printk("jffs_build_begin()\n")); | 96 | D3(printk("jffs_build_begin()\n")); |
| 97 | fmc = (struct jffs_fmcontrol *)kmalloc(sizeof(struct jffs_fmcontrol), | 97 | fmc = kmalloc(sizeof(*fmc), GFP_KERNEL); |
| 98 | GFP_KERNEL); | ||
| 99 | if (!fmc) { | 98 | if (!fmc) { |
| 100 | D(printk("jffs_build_begin(): Allocation of " | 99 | D(printk("jffs_build_begin(): Allocation of " |
| 101 | "struct jffs_fmcontrol failed!\n")); | 100 | "struct jffs_fmcontrol failed!\n")); |
| @@ -486,8 +485,7 @@ jffs_add_node(struct jffs_node *node) | |||
| 486 | 485 | ||
| 487 | D3(printk("jffs_add_node(): ino = %u\n", node->ino)); | 486 | D3(printk("jffs_add_node(): ino = %u\n", node->ino)); |
| 488 | 487 | ||
| 489 | ref = (struct jffs_node_ref *)kmalloc(sizeof(struct jffs_node_ref), | 488 | ref = kmalloc(sizeof(*ref), GFP_KERNEL); |
| 490 | GFP_KERNEL); | ||
| 491 | if (!ref) | 489 | if (!ref) |
| 492 | return -ENOMEM; | 490 | return -ENOMEM; |
| 493 | 491 | ||
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c index efbb586bed4b..3856efc399c1 100644 --- a/fs/jfs/jfs_txnmgr.c +++ b/fs/jfs/jfs_txnmgr.c | |||
| @@ -282,7 +282,7 @@ int txInit(void) | |||
| 282 | TxLockVHWM = (nTxLock * 8) / 10; | 282 | TxLockVHWM = (nTxLock * 8) / 10; |
| 283 | 283 | ||
| 284 | size = sizeof(struct tblock) * nTxBlock; | 284 | size = sizeof(struct tblock) * nTxBlock; |
| 285 | TxBlock = (struct tblock *) vmalloc(size); | 285 | TxBlock = vmalloc(size); |
| 286 | if (TxBlock == NULL) | 286 | if (TxBlock == NULL) |
| 287 | return -ENOMEM; | 287 | return -ENOMEM; |
| 288 | 288 | ||
| @@ -307,7 +307,7 @@ int txInit(void) | |||
| 307 | * tlock id = 0 is reserved. | 307 | * tlock id = 0 is reserved. |
| 308 | */ | 308 | */ |
| 309 | size = sizeof(struct tlock) * nTxLock; | 309 | size = sizeof(struct tlock) * nTxLock; |
| 310 | TxLock = (struct tlock *) vmalloc(size); | 310 | TxLock = vmalloc(size); |
| 311 | if (TxLock == NULL) { | 311 | if (TxLock == NULL) { |
| 312 | vfree(TxBlock); | 312 | vfree(TxBlock); |
| 313 | return -ENOMEM; | 313 | return -ENOMEM; |
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c index 50dbb67ae0c4..271e2165fff6 100644 --- a/fs/lockd/clntproc.c +++ b/fs/lockd/clntproc.c | |||
| @@ -100,7 +100,7 @@ static struct nlm_lockowner *nlm_find_lockowner(struct nlm_host *host, fl_owner_ | |||
| 100 | res = __nlm_find_lockowner(host, owner); | 100 | res = __nlm_find_lockowner(host, owner); |
| 101 | if (res == NULL) { | 101 | if (res == NULL) { |
| 102 | spin_unlock(&host->h_lock); | 102 | spin_unlock(&host->h_lock); |
| 103 | new = (struct nlm_lockowner *)kmalloc(sizeof(*new), GFP_KERNEL); | 103 | new = kmalloc(sizeof(*new), GFP_KERNEL); |
| 104 | spin_lock(&host->h_lock); | 104 | spin_lock(&host->h_lock); |
| 105 | res = __nlm_find_lockowner(host, owner); | 105 | res = __nlm_find_lockowner(host, owner); |
| 106 | if (res == NULL && new != NULL) { | 106 | if (res == NULL && new != NULL) { |
diff --git a/fs/ncpfs/symlink.c b/fs/ncpfs/symlink.c index ca92c2406635..e3d26c1bd105 100644 --- a/fs/ncpfs/symlink.c +++ b/fs/ncpfs/symlink.c | |||
| @@ -48,7 +48,7 @@ static int ncp_symlink_readpage(struct file *file, struct page *page) | |||
| 48 | char *buf = kmap(page); | 48 | char *buf = kmap(page); |
| 49 | 49 | ||
| 50 | error = -ENOMEM; | 50 | error = -ENOMEM; |
| 51 | rawlink=(char *)kmalloc(NCP_MAX_SYMLINK_SIZE, GFP_KERNEL); | 51 | rawlink = kmalloc(NCP_MAX_SYMLINK_SIZE, GFP_KERNEL); |
| 52 | if (!rawlink) | 52 | if (!rawlink) |
| 53 | goto fail; | 53 | goto fail; |
| 54 | 54 | ||
| @@ -126,7 +126,7 @@ int ncp_symlink(struct inode *dir, struct dentry *dentry, const char *symname) { | |||
| 126 | /* EPERM is returned by VFS if symlink procedure does not exist */ | 126 | /* EPERM is returned by VFS if symlink procedure does not exist */ |
| 127 | return -EPERM; | 127 | return -EPERM; |
| 128 | 128 | ||
| 129 | rawlink=(char *)kmalloc(NCP_MAX_SYMLINK_SIZE, GFP_KERNEL); | 129 | rawlink = kmalloc(NCP_MAX_SYMLINK_SIZE, GFP_KERNEL); |
| 130 | if (!rawlink) | 130 | if (!rawlink) |
| 131 | return -ENOMEM; | 131 | return -ENOMEM; |
| 132 | 132 | ||
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index 57133678db16..841c99a9b11c 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c | |||
| @@ -20,11 +20,6 @@ | |||
| 20 | #include "delegation.h" | 20 | #include "delegation.h" |
| 21 | #include "internal.h" | 21 | #include "internal.h" |
| 22 | 22 | ||
| 23 | static struct nfs_delegation *nfs_alloc_delegation(void) | ||
| 24 | { | ||
| 25 | return (struct nfs_delegation *)kmalloc(sizeof(struct nfs_delegation), GFP_KERNEL); | ||
| 26 | } | ||
| 27 | |||
| 28 | static void nfs_free_delegation(struct nfs_delegation *delegation) | 23 | static void nfs_free_delegation(struct nfs_delegation *delegation) |
| 29 | { | 24 | { |
| 30 | if (delegation->cred) | 25 | if (delegation->cred) |
| @@ -124,7 +119,7 @@ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct | |||
| 124 | if ((nfsi->cache_validity & (NFS_INO_REVAL_PAGECACHE|NFS_INO_INVALID_ATTR))) | 119 | if ((nfsi->cache_validity & (NFS_INO_REVAL_PAGECACHE|NFS_INO_INVALID_ATTR))) |
| 125 | __nfs_revalidate_inode(NFS_SERVER(inode), inode); | 120 | __nfs_revalidate_inode(NFS_SERVER(inode), inode); |
| 126 | 121 | ||
| 127 | delegation = nfs_alloc_delegation(); | 122 | delegation = kmalloc(sizeof(*delegation), GFP_KERNEL); |
| 128 | if (delegation == NULL) | 123 | if (delegation == NULL) |
| 129 | return -ENOMEM; | 124 | return -ENOMEM; |
| 130 | memcpy(delegation->stateid.data, res->delegation.data, | 125 | memcpy(delegation->stateid.data, res->delegation.data, |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index e8c143d182c4..a9d0f71eb5f7 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
| @@ -443,7 +443,7 @@ static struct nfs_open_context *alloc_nfs_open_context(struct vfsmount *mnt, str | |||
| 443 | { | 443 | { |
| 444 | struct nfs_open_context *ctx; | 444 | struct nfs_open_context *ctx; |
| 445 | 445 | ||
| 446 | ctx = (struct nfs_open_context *)kmalloc(sizeof(*ctx), GFP_KERNEL); | 446 | ctx = kmalloc(sizeof(*ctx), GFP_KERNEL); |
| 447 | if (ctx != NULL) { | 447 | if (ctx != NULL) { |
| 448 | atomic_set(&ctx->count, 1); | 448 | atomic_set(&ctx->count, 1); |
| 449 | ctx->dentry = dget(dentry); | 449 | ctx->dentry = dget(dentry); |
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index f8688eaa0001..3b234d4601e7 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c | |||
| @@ -449,7 +449,7 @@ nfs3_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir, struct qstr | |||
| 449 | struct nfs_fattr res; | 449 | struct nfs_fattr res; |
| 450 | } *ptr; | 450 | } *ptr; |
| 451 | 451 | ||
| 452 | ptr = (struct unlinkxdr *)kmalloc(sizeof(*ptr), GFP_KERNEL); | 452 | ptr = kmalloc(sizeof(*ptr), GFP_KERNEL); |
| 453 | if (!ptr) | 453 | if (!ptr) |
| 454 | return -ENOMEM; | 454 | return -ENOMEM; |
| 455 | ptr->arg.fh = NFS_FH(dir->d_inode); | 455 | ptr->arg.fh = NFS_FH(dir->d_inode); |
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index 630e50647bbb..4529cc4f3f8f 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c | |||
| @@ -352,7 +352,7 @@ nfs_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir, struct qstr * | |||
| 352 | { | 352 | { |
| 353 | struct nfs_diropargs *arg; | 353 | struct nfs_diropargs *arg; |
| 354 | 354 | ||
| 355 | arg = (struct nfs_diropargs *)kmalloc(sizeof(*arg), GFP_KERNEL); | 355 | arg = kmalloc(sizeof(*arg), GFP_KERNEL); |
| 356 | if (!arg) | 356 | if (!arg) |
| 357 | return -ENOMEM; | 357 | return -ENOMEM; |
| 358 | arg->fh = NFS_FH(dir->d_inode); | 358 | arg->fh = NFS_FH(dir->d_inode); |
diff --git a/fs/ntfs/dir.c b/fs/ntfs/dir.c index d1e2c6f9f05e..85c36b8ca452 100644 --- a/fs/ntfs/dir.c +++ b/fs/ntfs/dir.c | |||
| @@ -1149,8 +1149,7 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
| 1149 | * Allocate a buffer to store the current name being processed | 1149 | * Allocate a buffer to store the current name being processed |
| 1150 | * converted to format determined by current NLS. | 1150 | * converted to format determined by current NLS. |
| 1151 | */ | 1151 | */ |
| 1152 | name = (u8*)kmalloc(NTFS_MAX_NAME_LEN * NLS_MAX_CHARSET_SIZE + 1, | 1152 | name = kmalloc(NTFS_MAX_NAME_LEN * NLS_MAX_CHARSET_SIZE + 1, GFP_NOFS); |
| 1153 | GFP_NOFS); | ||
| 1154 | if (unlikely(!name)) { | 1153 | if (unlikely(!name)) { |
| 1155 | err = -ENOMEM; | 1154 | err = -ENOMEM; |
| 1156 | goto err_out; | 1155 | goto err_out; |
| @@ -1191,7 +1190,7 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
| 1191 | * map the mft record without deadlocking. | 1190 | * map the mft record without deadlocking. |
| 1192 | */ | 1191 | */ |
| 1193 | rc = le32_to_cpu(ctx->attr->data.resident.value_length); | 1192 | rc = le32_to_cpu(ctx->attr->data.resident.value_length); |
| 1194 | ir = (INDEX_ROOT*)kmalloc(rc, GFP_NOFS); | 1193 | ir = kmalloc(rc, GFP_NOFS); |
| 1195 | if (unlikely(!ir)) { | 1194 | if (unlikely(!ir)) { |
| 1196 | err = -ENOMEM; | 1195 | err = -ENOMEM; |
| 1197 | goto err_out; | 1196 | goto err_out; |
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c index d313f356e66a..31852121b3f5 100644 --- a/fs/ntfs/inode.c +++ b/fs/ntfs/inode.c | |||
| @@ -137,7 +137,7 @@ static int ntfs_init_locked_inode(struct inode *vi, ntfs_attr *na) | |||
| 137 | 137 | ||
| 138 | BUG_ON(!na->name); | 138 | BUG_ON(!na->name); |
| 139 | i = na->name_len * sizeof(ntfschar); | 139 | i = na->name_len * sizeof(ntfschar); |
| 140 | ni->name = (ntfschar*)kmalloc(i + sizeof(ntfschar), GFP_ATOMIC); | 140 | ni->name = kmalloc(i + sizeof(ntfschar), GFP_ATOMIC); |
| 141 | if (!ni->name) | 141 | if (!ni->name) |
| 142 | return -ENOMEM; | 142 | return -ENOMEM; |
| 143 | memcpy(ni->name, na->name, i); | 143 | memcpy(ni->name, na->name, i); |
diff --git a/fs/ntfs/mft.c b/fs/ntfs/mft.c index 2438c00ec0ce..578fb3d5e803 100644 --- a/fs/ntfs/mft.c +++ b/fs/ntfs/mft.c | |||
| @@ -331,7 +331,7 @@ map_err_out: | |||
| 331 | ntfs_inode **tmp; | 331 | ntfs_inode **tmp; |
| 332 | int new_size = (base_ni->nr_extents + 4) * sizeof(ntfs_inode *); | 332 | int new_size = (base_ni->nr_extents + 4) * sizeof(ntfs_inode *); |
| 333 | 333 | ||
| 334 | tmp = (ntfs_inode **)kmalloc(new_size, GFP_NOFS); | 334 | tmp = kmalloc(new_size, GFP_NOFS); |
| 335 | if (unlikely(!tmp)) { | 335 | if (unlikely(!tmp)) { |
| 336 | ntfs_error(base_ni->vol->sb, "Failed to allocate " | 336 | ntfs_error(base_ni->vol->sb, "Failed to allocate " |
| 337 | "internal buffer."); | 337 | "internal buffer."); |
| @@ -2893,7 +2893,7 @@ rollback: | |||
| 2893 | if (!(base_ni->nr_extents & 3)) { | 2893 | if (!(base_ni->nr_extents & 3)) { |
| 2894 | int new_size = (base_ni->nr_extents + 4) * sizeof(ntfs_inode*); | 2894 | int new_size = (base_ni->nr_extents + 4) * sizeof(ntfs_inode*); |
| 2895 | 2895 | ||
| 2896 | extent_nis = (ntfs_inode**)kmalloc(new_size, GFP_NOFS); | 2896 | extent_nis = kmalloc(new_size, GFP_NOFS); |
| 2897 | if (unlikely(!extent_nis)) { | 2897 | if (unlikely(!extent_nis)) { |
| 2898 | ntfs_error(vol->sb, "Failed to allocate internal " | 2898 | ntfs_error(vol->sb, "Failed to allocate internal " |
| 2899 | "buffer during rollback.%s", es); | 2899 | "buffer during rollback.%s", es); |
diff --git a/fs/ntfs/unistr.c b/fs/ntfs/unistr.c index b123c0fa6bf6..a1b572196fe4 100644 --- a/fs/ntfs/unistr.c +++ b/fs/ntfs/unistr.c | |||
| @@ -350,7 +350,7 @@ int ntfs_ucstonls(const ntfs_volume *vol, const ntfschar *ins, | |||
| 350 | } | 350 | } |
| 351 | if (!ns) { | 351 | if (!ns) { |
| 352 | ns_len = ins_len * NLS_MAX_CHARSET_SIZE; | 352 | ns_len = ins_len * NLS_MAX_CHARSET_SIZE; |
| 353 | ns = (unsigned char*)kmalloc(ns_len + 1, GFP_NOFS); | 353 | ns = kmalloc(ns_len + 1, GFP_NOFS); |
| 354 | if (!ns) | 354 | if (!ns) |
| 355 | goto mem_err_out; | 355 | goto mem_err_out; |
| 356 | } | 356 | } |
| @@ -365,7 +365,7 @@ retry: wc = nls->uni2char(le16_to_cpu(ins[i]), ns + o, | |||
| 365 | else if (wc == -ENAMETOOLONG && ns != *outs) { | 365 | else if (wc == -ENAMETOOLONG && ns != *outs) { |
| 366 | unsigned char *tc; | 366 | unsigned char *tc; |
| 367 | /* Grow in multiples of 64 bytes. */ | 367 | /* Grow in multiples of 64 bytes. */ |
| 368 | tc = (unsigned char*)kmalloc((ns_len + 64) & | 368 | tc = kmalloc((ns_len + 64) & |
| 369 | ~63, GFP_NOFS); | 369 | ~63, GFP_NOFS); |
| 370 | if (tc) { | 370 | if (tc) { |
| 371 | memcpy(tc, ns, ns_len); | 371 | memcpy(tc, ns, ns_len); |
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c index 3d4f6dff2113..41cfcba7ce49 100644 --- a/fs/xfs/linux-2.6/xfs_file.c +++ b/fs/xfs/linux-2.6/xfs_file.c | |||
| @@ -370,7 +370,7 @@ xfs_file_readdir( | |||
| 370 | 370 | ||
| 371 | /* Try fairly hard to get memory */ | 371 | /* Try fairly hard to get memory */ |
| 372 | do { | 372 | do { |
| 373 | if ((read_buf = (caddr_t)kmalloc(rlen, GFP_KERNEL))) | 373 | if ((read_buf = kmalloc(rlen, GFP_KERNEL))) |
| 374 | break; | 374 | break; |
| 375 | rlen >>= 1; | 375 | rlen >>= 1; |
| 376 | } while (rlen >= 1024); | 376 | } while (rlen >= 1024); |
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index d9180020de63..22e3b714f629 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
| @@ -553,13 +553,13 @@ xfs_vn_follow_link( | |||
| 553 | ASSERT(dentry); | 553 | ASSERT(dentry); |
| 554 | ASSERT(nd); | 554 | ASSERT(nd); |
| 555 | 555 | ||
| 556 | link = (char *)kmalloc(MAXPATHLEN+1, GFP_KERNEL); | 556 | link = kmalloc(MAXPATHLEN+1, GFP_KERNEL); |
| 557 | if (!link) { | 557 | if (!link) { |
| 558 | nd_set_link(nd, ERR_PTR(-ENOMEM)); | 558 | nd_set_link(nd, ERR_PTR(-ENOMEM)); |
| 559 | return NULL; | 559 | return NULL; |
| 560 | } | 560 | } |
| 561 | 561 | ||
| 562 | uio = (uio_t *)kmalloc(sizeof(uio_t), GFP_KERNEL); | 562 | uio = kmalloc(sizeof(uio_t), GFP_KERNEL); |
| 563 | if (!uio) { | 563 | if (!uio) { |
| 564 | kfree(link); | 564 | kfree(link); |
| 565 | nd_set_link(nd, ERR_PTR(-ENOMEM)); | 565 | nd_set_link(nd, ERR_PTR(-ENOMEM)); |
