* [PATCH] sctp: dont cast void* from kmalloc()
@ 2011-08-13 9:43 Thomas Meyer
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Meyer @ 2011-08-13 9:43 UTC (permalink / raw)
To: David S. Miller, linux-sctp, linux-kernel
From: Thomas Meyer <thomas@m3y3r.de>
Casting (void *) value returned by kmalloc is useless
as mentioned in Documentation/CodingStyle, Chap 14.
The semantic patch that makes this output is available
in scripts/coccinelle/api/alloc/drop_kmalloc_cast.cocci.
More information about semantic patching is available at
http://coccinelle.lip6.fr/
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
diff -u -p a/net/sctp/protocol.c b/net/sctp/protocol.c
--- a/net/sctp/protocol.c 2011-07-26 00:46:12.663489013 +0200
+++ b/net/sctp/protocol.c 2011-08-01 20:02:43.478907122 +0200
@@ -1337,7 +1337,7 @@ SCTP_STATIC __init int sctp_init(void)
/* Allocate and initialize the endpoint hash table. */
sctp_ep_hashsize = 64;
- sctp_ep_hashtable = (struct sctp_hashbucket *)
+ sctp_ep_hashtable =
kmalloc(64 * sizeof(struct sctp_hashbucket), GFP_KERNEL);
if (!sctp_ep_hashtable) {
pr_err("Failed endpoint_hash alloc\n");
^ permalink raw reply [flat|nested] 2+ messages in thread* [PATCH] sctp: dont cast void* from kmalloc()
@ 2011-08-13 9:41 Thomas Meyer
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Meyer @ 2011-08-13 9:41 UTC (permalink / raw)
To: David S. Miller, linux-sctp, Linux Kernel Mailing List
From: Thomas Meyer <thomas@m3y3r.de>
Casting (void *) value returned by kmalloc is useless
as mentioned in Documentation/CodingStyle, Chap 14.
The semantic patch that makes this output is available
in scripts/coccinelle/api/alloc/drop_kmalloc_cast.cocci.
More information about semantic patching is available at
http://coccinelle.lip6.fr/
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
diff -u -p a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
--- a/include/net/sctp/sctp.h 2011-07-26 00:46:11.646827854 +0200
+++ b/include/net/sctp/sctp.h 2011-08-01 19:40:06.389592439 +0200
@@ -559,7 +559,7 @@ for (pos = chunk->subh.fwdtsn_hdr->skip;
#define WORD_ROUND(s) (((s)+3)&~3)
/* Make a new instance of type. */
-#define t_new(type, flags) (type *)kzalloc(sizeof(type), flags)
+#define t_new(type, flags) kzalloc(sizeof(type), flags)
/* Compare two timevals. */
#define tv_lt(s, t) \
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-08-13 14:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-13 9:43 [PATCH] sctp: dont cast void* from kmalloc() Thomas Meyer
-- strict thread matches above, loose matches on Subject: below --
2011-08-13 9:41 Thomas Meyer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox