From: "Joonwoo Park" <joonwpark81@gmail.com>
To: <netdev@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/4] fib_semantics: kmalloc + memset conversion to kzalloc
Date: Mon, 26 Nov 2007 18:02:39 +0900 [thread overview]
Message-ID: <007d01c8300b$18be5740$9c94fea9@jason> (raw)
fib_semantics: kmalloc + memset conversion to kzalloc
Signed-off-by: Joonwoo Park <joonwpark81@gmail.com>
Thanks.
Joonwoo
---
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 1351a26..87a1e72 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -605,10 +605,15 @@ 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);
- else
- return (struct hlist_head *)
+ return kzalloc(bytes, GFP_KERNEL);
+ else {
+ struct hlist_head *hash;
+ hash = (struct hlist_head *)
__get_free_pages(GFP_KERNEL, get_order(bytes));
+ if (hash)
+ memset(hash, 0, bytes);
+ return hash;
+ }
}
static void fib_hash_free(struct hlist_head *hash, int bytes)
@@ -712,12 +717,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;
---
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 2/4] fib_semantics: kmalloc + memset conversion to kzalloc Joonwoo Park
2007-11-26 15:29 ` 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='007d01c8300b$18be5740$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;
as well as URLs for NNTP newsgroup(s).