Re: [PATCH 2/4] fib_semantics: kmalloc + memset conversion to kzalloc

Subsystems: networking [general], networking [ipv4/ipv6], the rest

2 messages, 2 authors, 2007-11-26 · open the first message on its own page

Re: [PATCH 2/4] fib_semantics: kmalloc + memset conversion to kzalloc

From: Joonwoo Park <hidden>
Date: 2007-11-26 10:25:14

fib_semantics: kmalloc + memset conversion to kzalloc
fix to avoid memset entirely.

Thanks.
Joonwoo

Signed-off-by: Joonwoo Park <redacted>

---
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 1351a26..352f8c4 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -605,10 +605,10 @@ static inline unsigned int fib_laddr_hashfn(__be32 val)
 static struct hlist_head *fib_hash_alloc(int bytes)
 {
 	if (bytes <= PAGE_SIZE)
-		return kmalloc(bytes, GFP_KERNEL);
+		return kzalloc(bytes, GFP_KERNEL);
 	else
 		return (struct hlist_head *)
-			__get_free_pages(GFP_KERNEL, get_order(bytes));
+			__get_free_pages(GFP_KERNEL | __GFP_ZERO, get_order(bytes));
 }
 
 static void fib_hash_free(struct hlist_head *hash, int bytes)
@@ -712,12 +712,8 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
 		if (!new_info_hash || !new_laddrhash) {
 			fib_hash_free(new_info_hash, bytes);
 			fib_hash_free(new_laddrhash, bytes);
-		} else {
-			memset(new_info_hash, 0, bytes);
-			memset(new_laddrhash, 0, bytes);
-
+		} else
 			fib_hash_move(new_info_hash, new_laddrhash, new_size);
-		}
 
 		if (!fib_hash_size)
 			goto failure;
---

Re: [PATCH 2/4] fib_semantics: kmalloc + memset conversion to kzalloc

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2007-11-26 15:30:11

On Mon, Nov 26, 2007 at 10:24:03AM +0000, Joonwoo Park wrote:
fib_semantics: kmalloc + memset conversion to kzalloc
fix to avoid memset entirely.
Also applied.
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} [off-list ref]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help