mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Robert P. J. Day" <rpjday@mindspring.com>
To: Linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: [PATCH] kernel: replace "kmalloc+memset" with kzalloc in kernel/ dir
Date: Sun, 3 Dec 2006 08:31:50 -0500 (EST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0612030829400.3793@localhost.localdomain> (raw)


  Replace kmalloc()+memset() combination with kzalloc().

Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>

---

 auditfilter.c |    3 +--
 futex.c       |    4 +---
 kexec.c       |    3 +--
 3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index 4f40d92..2e896f8 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -636,10 +636,9 @@ static struct audit_rule *audit_krule_to
 	struct audit_rule *rule;
 	int i;

-	rule = kmalloc(sizeof(*rule), GFP_KERNEL);
+	rule = kzalloc(sizeof(*rule), GFP_KERNEL);
 	if (unlikely(!rule))
 		return NULL;
-	memset(rule, 0, sizeof(*rule));

 	rule->flags = krule->flags | krule->listnr;
 	rule->action = krule->action;
diff --git a/kernel/futex.c b/kernel/futex.c
index 93ef30b..999bfaf 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -324,12 +324,10 @@ static int refill_pi_state_cache(void)
 	if (likely(current->pi_state_cache))
 		return 0;

-	pi_state = kmalloc(sizeof(*pi_state), GFP_KERNEL);
-
+	pi_state = kzalloc(sizeof(*pi_state), GFP_KERNEL);
 	if (!pi_state)
 		return -ENOMEM;

-	memset(pi_state, 0, sizeof(*pi_state));
 	INIT_LIST_HEAD(&pi_state->list);
 	/* pi_mutex gets initialized later */
 	pi_state->owner = NULL;
diff --git a/kernel/kexec.c b/kernel/kexec.c
index fcdd5d2..d43692c 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -108,11 +108,10 @@ static int do_kimage_alloc(struct kimage

 	/* Allocate a controlling structure */
 	result = -ENOMEM;
-	image = kmalloc(sizeof(*image), GFP_KERNEL);
+	image = kzalloc(sizeof(*image), GFP_KERNEL);
 	if (!image)
 		goto out;

-	memset(image, 0, sizeof(*image));
 	image->head = 0;
 	image->entry = &image->head;
 	image->last_entry = &image->head;

             reply	other threads:[~2006-12-03 13:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-03 13:31 Robert P. J. Day [this message]
2006-12-03 16:21 ` Alan
2006-12-03 17:24 ` Randy Dunlap
2006-12-03 17:27   ` Robert P. J. Day
2006-12-03 17:32     ` Randy Dunlap

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=Pine.LNX.4.64.0612030829400.3793@localhost.localdomain \
    --to=rpjday@mindspring.com \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®