Skip to contentSkip to conversation

sctp: dont cast void* from kmalloc()

PATCH New Thomas Meyer 1 participant 1 message Aug 13, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sctp: dont cast void* from kmalloc()

From: Thomas Meyer <[email protected]>

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/

---

net/sctp/protocol.c 2011-08-01 20:02:43.478907122 +0200 renamed from net/sctp/protocol.c 2011-07-26 00:46:12.663489013 +0200 +1 -1
diff -u -p a/net/sctp/protocol.c b/net/sctp/protocol.c
@@ -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");