diff options
author | Robert P. J. Day <rpjday@mindspring.com> | 2006-12-13 03:35:56 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-13 12:05:58 -0500 |
commit | 5cbded585d129d0226cb48ac4202b253c781be26 (patch) | |
tree | fb24edc194a57ee81a3bf8a4dd8a95030dd0ad22 /fs | |
parent | 0743b86800cf1dfbf96df4a438938127bbe4476c (diff) |
[PATCH] getting rid of all casts of k[cmz]alloc() calls
Run this:
#!/bin/sh
for f in $(grep -Erl "\([^\)]*\) *k[cmz]alloc" *) ; do
echo "De-casting $f..."
perl -pi -e "s/ ?= ?\([^\)]*\) *(k[cmz]alloc) *\(/ = \1\(/" $f
done
And then go through and reinstate those cases where code is casting pointers
to non-pointers.
And then drop a few hunks which conflicted with outstanding work.
Cc: Russell King <rmk@arm.linux.org.uk>, Ian Molton <spyro@f2s.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Greg KH <greg@kroah.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Paul Fulghum <paulkf@microgate.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Karsten Keil <kkeil@suse.de>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: Ian Kent <raven@themaw.net>
Cc: Steven French <sfrench@us.ibm.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Neil Brown <neilb@cse.unsw.edu.au>
Cc: Jaroslav Kysela <perex@suse.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/autofs4/inode.c | 2 | ||||
-rw-r--r-- | fs/befs/btree.c | 2 | ||||
-rw-r--r-- | fs/befs/debug.c | 6 | ||||
-rw-r--r-- | fs/binfmt_misc.c | 2 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 2 | ||||
-rw-r--r-- | fs/jffs/inode-v23.c | 4 | ||||
-rw-r--r-- | fs/jffs/intrep.c | 14 | ||||
-rw-r--r-- | fs/jfs/jfs_dtree.c | 4 | ||||
-rw-r--r-- | fs/jfs/jfs_imap.c | 2 | ||||
-rw-r--r-- | fs/lockd/svcshare.c | 2 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/xattr_acl.c | 2 |
12 files changed, 22 insertions, 22 deletions
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c index 9c48250fd726..e8f6c5ad3e90 100644 --- a/fs/autofs4/inode.c +++ b/fs/autofs4/inode.c | |||
@@ -313,7 +313,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
313 | struct autofs_sb_info *sbi; | 313 | struct autofs_sb_info *sbi; |
314 | struct autofs_info *ino; | 314 | struct autofs_info *ino; |
315 | 315 | ||
316 | sbi = (struct autofs_sb_info *) kmalloc(sizeof(*sbi), GFP_KERNEL); | 316 | sbi = kmalloc(sizeof(*sbi), GFP_KERNEL); |
317 | if ( !sbi ) | 317 | if ( !sbi ) |
318 | goto fail_unlock; | 318 | goto fail_unlock; |
319 | DPRINTK("starting up, sbi = %p",sbi); | 319 | DPRINTK("starting up, sbi = %p",sbi); |
diff --git a/fs/befs/btree.c b/fs/befs/btree.c index 81b042ee24e6..af5bb93276f8 100644 --- a/fs/befs/btree.c +++ b/fs/befs/btree.c | |||
@@ -260,7 +260,7 @@ befs_btree_find(struct super_block *sb, befs_data_stream * ds, | |||
260 | goto error; | 260 | goto error; |
261 | } | 261 | } |
262 | 262 | ||
263 | this_node = (befs_btree_node *) kmalloc(sizeof (befs_btree_node), | 263 | this_node = kmalloc(sizeof (befs_btree_node), |
264 | GFP_NOFS); | 264 | GFP_NOFS); |
265 | if (!this_node) { | 265 | if (!this_node) { |
266 | befs_error(sb, "befs_btree_find() failed to allocate %u " | 266 | befs_error(sb, "befs_btree_find() failed to allocate %u " |
diff --git a/fs/befs/debug.c b/fs/befs/debug.c index e831a8f30849..b8e304a0661e 100644 --- a/fs/befs/debug.c +++ b/fs/befs/debug.c | |||
@@ -28,7 +28,7 @@ void | |||
28 | befs_error(const struct super_block *sb, const char *fmt, ...) | 28 | befs_error(const struct super_block *sb, const char *fmt, ...) |
29 | { | 29 | { |
30 | va_list args; | 30 | va_list args; |
31 | char *err_buf = (char *) kmalloc(ERRBUFSIZE, GFP_KERNEL); | 31 | char *err_buf = kmalloc(ERRBUFSIZE, GFP_KERNEL); |
32 | if (err_buf == NULL) { | 32 | if (err_buf == NULL) { |
33 | printk(KERN_ERR "could not allocate %d bytes\n", ERRBUFSIZE); | 33 | printk(KERN_ERR "could not allocate %d bytes\n", ERRBUFSIZE); |
34 | return; | 34 | return; |
@@ -46,7 +46,7 @@ void | |||
46 | befs_warning(const struct super_block *sb, const char *fmt, ...) | 46 | befs_warning(const struct super_block *sb, const char *fmt, ...) |
47 | { | 47 | { |
48 | va_list args; | 48 | va_list args; |
49 | char *err_buf = (char *) kmalloc(ERRBUFSIZE, GFP_KERNEL); | 49 | char *err_buf = kmalloc(ERRBUFSIZE, GFP_KERNEL); |
50 | if (err_buf == NULL) { | 50 | if (err_buf == NULL) { |
51 | printk(KERN_ERR "could not allocate %d bytes\n", ERRBUFSIZE); | 51 | printk(KERN_ERR "could not allocate %d bytes\n", ERRBUFSIZE); |
52 | return; | 52 | return; |
@@ -70,7 +70,7 @@ befs_debug(const struct super_block *sb, const char *fmt, ...) | |||
70 | char *err_buf = NULL; | 70 | char *err_buf = NULL; |
71 | 71 | ||
72 | if (BEFS_SB(sb)->mount_opts.debug) { | 72 | if (BEFS_SB(sb)->mount_opts.debug) { |
73 | err_buf = (char *) kmalloc(ERRBUFSIZE, GFP_KERNEL); | 73 | err_buf = kmalloc(ERRBUFSIZE, GFP_KERNEL); |
74 | if (err_buf == NULL) { | 74 | if (err_buf == NULL) { |
75 | printk(KERN_ERR "could not allocate %d bytes\n", | 75 | printk(KERN_ERR "could not allocate %d bytes\n", |
76 | ERRBUFSIZE); | 76 | ERRBUFSIZE); |
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index 00687ea62738..c2e08252af35 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c | |||
@@ -311,7 +311,7 @@ static Node *create_entry(const char __user *buffer, size_t count) | |||
311 | 311 | ||
312 | err = -ENOMEM; | 312 | err = -ENOMEM; |
313 | memsize = sizeof(Node) + count + 8; | 313 | memsize = sizeof(Node) + count + 8; |
314 | e = (Node *) kmalloc(memsize, GFP_USER); | 314 | e = kmalloc(memsize, GFP_USER); |
315 | if (!e) | 315 | if (!e) |
316 | goto out; | 316 | goto out; |
317 | 317 | ||
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 098790eb2aa1..472e33e0f3cf 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -4876,7 +4876,7 @@ int CIFSSMBNotify(const int xid, struct cifsTconInfo *tcon, | |||
4876 | } else { | 4876 | } else { |
4877 | /* Add file to outstanding requests */ | 4877 | /* Add file to outstanding requests */ |
4878 | /* BB change to kmem cache alloc */ | 4878 | /* BB change to kmem cache alloc */ |
4879 | dnotify_req = (struct dir_notify_req *) kmalloc( | 4879 | dnotify_req = kmalloc( |
4880 | sizeof(struct dir_notify_req), | 4880 | sizeof(struct dir_notify_req), |
4881 | GFP_KERNEL); | 4881 | GFP_KERNEL); |
4882 | if(dnotify_req) { | 4882 | if(dnotify_req) { |
diff --git a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c index 7b40c69f44eb..43baa1afa021 100644 --- a/fs/jffs/inode-v23.c +++ b/fs/jffs/inode-v23.c | |||
@@ -818,7 +818,7 @@ jffs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
818 | 818 | ||
819 | D1({ | 819 | D1({ |
820 | int len = dentry->d_name.len; | 820 | int len = dentry->d_name.len; |
821 | char *_name = (char *) kmalloc(len + 1, GFP_KERNEL); | 821 | char *_name = kmalloc(len + 1, GFP_KERNEL); |
822 | memcpy(_name, dentry->d_name.name, len); | 822 | memcpy(_name, dentry->d_name.name, len); |
823 | _name[len] = '\0'; | 823 | _name[len] = '\0'; |
824 | printk("***jffs_mkdir(): dir = 0x%p, name = \"%s\", " | 824 | printk("***jffs_mkdir(): dir = 0x%p, name = \"%s\", " |
@@ -964,7 +964,7 @@ jffs_remove(struct inode *dir, struct dentry *dentry, int type) | |||
964 | D1({ | 964 | D1({ |
965 | int len = dentry->d_name.len; | 965 | int len = dentry->d_name.len; |
966 | const char *name = dentry->d_name.name; | 966 | const char *name = dentry->d_name.name; |
967 | char *_name = (char *) kmalloc(len + 1, GFP_KERNEL); | 967 | char *_name = kmalloc(len + 1, GFP_KERNEL); |
968 | memcpy(_name, name, len); | 968 | memcpy(_name, name, len); |
969 | _name[len] = '\0'; | 969 | _name[len] = '\0'; |
970 | printk("***jffs_remove(): file = \"%s\", ino = %ld\n", _name, dentry->d_inode->i_ino); | 970 | printk("***jffs_remove(): file = \"%s\", ino = %ld\n", _name, dentry->d_inode->i_ino); |
diff --git a/fs/jffs/intrep.c b/fs/jffs/intrep.c index d0e783f199ea..6dd18911b44c 100644 --- a/fs/jffs/intrep.c +++ b/fs/jffs/intrep.c | |||
@@ -436,7 +436,7 @@ jffs_checksum_flash(struct mtd_info *mtd, loff_t start, int size, __u32 *result) | |||
436 | int i, length; | 436 | int i, length; |
437 | 437 | ||
438 | /* Allocate read buffer */ | 438 | /* Allocate read buffer */ |
439 | read_buf = (__u8 *) kmalloc (sizeof(__u8) * 4096, GFP_KERNEL); | 439 | read_buf = kmalloc(sizeof(__u8) * 4096, GFP_KERNEL); |
440 | if (!read_buf) { | 440 | if (!read_buf) { |
441 | printk(KERN_NOTICE "kmalloc failed in jffs_checksum_flash()\n"); | 441 | printk(KERN_NOTICE "kmalloc failed in jffs_checksum_flash()\n"); |
442 | return -ENOMEM; | 442 | return -ENOMEM; |
@@ -744,11 +744,11 @@ static int check_partly_erased_sectors(struct jffs_fmcontrol *fmc){ | |||
744 | 744 | ||
745 | 745 | ||
746 | /* Allocate read buffers */ | 746 | /* Allocate read buffers */ |
747 | read_buf1 = (__u8 *) kmalloc (sizeof(__u8) * READ_AHEAD_BYTES, GFP_KERNEL); | 747 | read_buf1 = kmalloc(sizeof(__u8) * READ_AHEAD_BYTES, GFP_KERNEL); |
748 | if (!read_buf1) | 748 | if (!read_buf1) |
749 | return -ENOMEM; | 749 | return -ENOMEM; |
750 | 750 | ||
751 | read_buf2 = (__u8 *) kmalloc (sizeof(__u8) * READ_AHEAD_BYTES, GFP_KERNEL); | 751 | read_buf2 = kmalloc(sizeof(__u8) * READ_AHEAD_BYTES, GFP_KERNEL); |
752 | if (!read_buf2) { | 752 | if (!read_buf2) { |
753 | kfree(read_buf1); | 753 | kfree(read_buf1); |
754 | return -ENOMEM; | 754 | return -ENOMEM; |
@@ -876,7 +876,7 @@ jffs_scan_flash(struct jffs_control *c) | |||
876 | } | 876 | } |
877 | 877 | ||
878 | /* Allocate read buffer */ | 878 | /* Allocate read buffer */ |
879 | read_buf = (__u8 *) kmalloc (sizeof(__u8) * 4096, GFP_KERNEL); | 879 | read_buf = kmalloc(sizeof(__u8) * 4096, GFP_KERNEL); |
880 | if (!read_buf) { | 880 | if (!read_buf) { |
881 | flash_safe_release(fmc->mtd); | 881 | flash_safe_release(fmc->mtd); |
882 | return -ENOMEM; | 882 | return -ENOMEM; |
@@ -1463,7 +1463,7 @@ jffs_insert_node(struct jffs_control *c, struct jffs_file *f, | |||
1463 | kfree(f->name); | 1463 | kfree(f->name); |
1464 | DJM(no_name--); | 1464 | DJM(no_name--); |
1465 | } | 1465 | } |
1466 | if (!(f->name = (char *) kmalloc(raw_inode->nsize + 1, | 1466 | if (!(f->name = kmalloc(raw_inode->nsize + 1, |
1467 | GFP_KERNEL))) { | 1467 | GFP_KERNEL))) { |
1468 | return -ENOMEM; | 1468 | return -ENOMEM; |
1469 | } | 1469 | } |
@@ -1737,7 +1737,7 @@ jffs_find_child(struct jffs_file *dir, const char *name, int len) | |||
1737 | printk("jffs_find_child(): Found \"%s\".\n", f->name); | 1737 | printk("jffs_find_child(): Found \"%s\".\n", f->name); |
1738 | } | 1738 | } |
1739 | else { | 1739 | else { |
1740 | char *copy = (char *) kmalloc(len + 1, GFP_KERNEL); | 1740 | char *copy = kmalloc(len + 1, GFP_KERNEL); |
1741 | if (copy) { | 1741 | if (copy) { |
1742 | memcpy(copy, name, len); | 1742 | memcpy(copy, name, len); |
1743 | copy[len] = '\0'; | 1743 | copy[len] = '\0'; |
@@ -2627,7 +2627,7 @@ jffs_print_tree(struct jffs_file *first_file, int indent) | |||
2627 | return; | 2627 | return; |
2628 | } | 2628 | } |
2629 | 2629 | ||
2630 | if (!(space = (char *) kmalloc(indent + 1, GFP_KERNEL))) { | 2630 | if (!(space = kmalloc(indent + 1, GFP_KERNEL))) { |
2631 | printk("jffs_print_tree(): Out of memory!\n"); | 2631 | printk("jffs_print_tree(): Out of memory!\n"); |
2632 | return; | 2632 | return; |
2633 | } | 2633 | } |
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c index 47bc0b5d1324..6d62f3222892 100644 --- a/fs/jfs/jfs_dtree.c +++ b/fs/jfs/jfs_dtree.c | |||
@@ -3777,12 +3777,12 @@ static int ciGetLeafPrefixKey(dtpage_t * lp, int li, dtpage_t * rp, | |||
3777 | struct component_name lkey; | 3777 | struct component_name lkey; |
3778 | struct component_name rkey; | 3778 | struct component_name rkey; |
3779 | 3779 | ||
3780 | lkey.name = (wchar_t *) kmalloc((JFS_NAME_MAX + 1) * sizeof(wchar_t), | 3780 | lkey.name = kmalloc((JFS_NAME_MAX + 1) * sizeof(wchar_t), |
3781 | GFP_KERNEL); | 3781 | GFP_KERNEL); |
3782 | if (lkey.name == NULL) | 3782 | if (lkey.name == NULL) |
3783 | return -ENOMEM; | 3783 | return -ENOMEM; |
3784 | 3784 | ||
3785 | rkey.name = (wchar_t *) kmalloc((JFS_NAME_MAX + 1) * sizeof(wchar_t), | 3785 | rkey.name = kmalloc((JFS_NAME_MAX + 1) * sizeof(wchar_t), |
3786 | GFP_KERNEL); | 3786 | GFP_KERNEL); |
3787 | if (rkey.name == NULL) { | 3787 | if (rkey.name == NULL) { |
3788 | kfree(lkey.name); | 3788 | kfree(lkey.name); |
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c index ee9b473b7b80..53f63b47a6d3 100644 --- a/fs/jfs/jfs_imap.c +++ b/fs/jfs/jfs_imap.c | |||
@@ -120,7 +120,7 @@ int diMount(struct inode *ipimap) | |||
120 | * allocate/initialize the in-memory inode map control structure | 120 | * allocate/initialize the in-memory inode map control structure |
121 | */ | 121 | */ |
122 | /* allocate the in-memory inode map control structure. */ | 122 | /* allocate the in-memory inode map control structure. */ |
123 | imap = (struct inomap *) kmalloc(sizeof(struct inomap), GFP_KERNEL); | 123 | imap = kmalloc(sizeof(struct inomap), GFP_KERNEL); |
124 | if (imap == NULL) { | 124 | if (imap == NULL) { |
125 | jfs_err("diMount: kmalloc returned NULL!"); | 125 | jfs_err("diMount: kmalloc returned NULL!"); |
126 | return -ENOMEM; | 126 | return -ENOMEM; |
diff --git a/fs/lockd/svcshare.c b/fs/lockd/svcshare.c index 6220dc2a3f2c..068886de4dda 100644 --- a/fs/lockd/svcshare.c +++ b/fs/lockd/svcshare.c | |||
@@ -39,7 +39,7 @@ nlmsvc_share_file(struct nlm_host *host, struct nlm_file *file, | |||
39 | return nlm_lck_denied; | 39 | return nlm_lck_denied; |
40 | } | 40 | } |
41 | 41 | ||
42 | share = (struct nlm_share *) kmalloc(sizeof(*share) + oh->len, | 42 | share = kmalloc(sizeof(*share) + oh->len, |
43 | GFP_KERNEL); | 43 | GFP_KERNEL); |
44 | if (share == NULL) | 44 | if (share == NULL) |
45 | return nlm_lck_denied_nolocks; | 45 | return nlm_lck_denied_nolocks; |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index ee458aeab24a..b3fd29baadc3 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -1877,7 +1877,7 @@ static int nfs4_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir, | |||
1877 | struct nfs_server *server = NFS_SERVER(dir->d_inode); | 1877 | struct nfs_server *server = NFS_SERVER(dir->d_inode); |
1878 | struct unlink_desc *up; | 1878 | struct unlink_desc *up; |
1879 | 1879 | ||
1880 | up = (struct unlink_desc *) kmalloc(sizeof(*up), GFP_KERNEL); | 1880 | up = kmalloc(sizeof(*up), GFP_KERNEL); |
1881 | if (!up) | 1881 | if (!up) |
1882 | return -ENOMEM; | 1882 | return -ENOMEM; |
1883 | 1883 | ||
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c index 97ae1b92bc47..5296a29cc5eb 100644 --- a/fs/reiserfs/xattr_acl.c +++ b/fs/reiserfs/xattr_acl.c | |||
@@ -135,7 +135,7 @@ static void *posix_acl_to_disk(const struct posix_acl *acl, size_t * size) | |||
135 | int n; | 135 | int n; |
136 | 136 | ||
137 | *size = reiserfs_acl_size(acl->a_count); | 137 | *size = reiserfs_acl_size(acl->a_count); |
138 | ext_acl = (reiserfs_acl_header *) kmalloc(sizeof(reiserfs_acl_header) + | 138 | ext_acl = kmalloc(sizeof(reiserfs_acl_header) + |
139 | acl->a_count * | 139 | acl->a_count * |
140 | sizeof(reiserfs_acl_entry), | 140 | sizeof(reiserfs_acl_entry), |
141 | GFP_NOFS); | 141 | GFP_NOFS); |