From: "Joonwoo Park" <joonwpark81@gmail.com>
To: <netdev@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>
Subject: [PATCH 3/4] fib_hash: kmalloc + memset conversion to kzalloc
Date: Mon, 26 Nov 2007 18:02:40 +0900 [thread overview]
Message-ID: <007e01c8300b$1a1f46d0$9c94fea9@jason> (raw)
fib_hash: kmalloc + memset conversion to kzalloc
Signed-off-by: Joonwoo Park <joonwpark81@gmail.com>
Thanks.
Joonwoo
---
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c
index 527a6e0..2874fe7 100644
--- a/net/ipv4/fib_hash.c
+++ b/net/ipv4/fib_hash.c
@@ -102,10 +102,14 @@ static struct hlist_head *fz_hash_alloc(int divisor)
unsigned long size = divisor * sizeof(struct hlist_head);
if (size <= PAGE_SIZE) {
- return kmalloc(size, GFP_KERNEL);
+ return kzalloc(size, GFP_KERNEL);
} else {
- return (struct hlist_head *)
+ struct hlist_head *hash;
+ hash = (struct hlist_head *)
__get_free_pages(GFP_KERNEL, get_order(size));
+ if (hash)
+ memset(hash, 0, size);
+ return hash;
}
}
@@ -174,8 +178,6 @@ static void fn_rehash_zone(struct fn_zone *fz)
ht = fz_hash_alloc(new_divisor);
if (ht) {
- memset(ht, 0, new_divisor * sizeof(struct hlist_head));
-
write_lock_bh(&fib_hash_lock);
old_ht = fz->fz_hash;
fz->fz_hash = ht;
@@ -219,7 +221,6 @@ fn_new_zone(struct fn_hash *table, int z)
kfree(fz);
return NULL;
}
- memset(fz->fz_hash, 0, fz->fz_divisor * sizeof(struct hlist_head *));
fz->fz_order = z;
fz->fz_mask = inet_make_mask(z);
---
next reply other threads:[~2007-11-26 9:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-26 9:02 Joonwoo Park [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-11-26 10:24 [PATCH 3/4] fib_hash: kmalloc + memset conversion to kzalloc Joonwoo Park
2007-11-26 15:31 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='007e01c8300b$1a1f46d0$9c94fea9@jason' \
--to=joonwpark81@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox