From: Kyungmin Park <kmpark@infradead.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Use correct kzalloc
Date: Mon, 06 Oct 2008 11:20:28 +0900 [thread overview]
Message-ID: <20081006022028.GA5522@july> (raw)
I'm not sure calloc returns all zero values.
Actually the calloc uses the __libc_alloc.
Instead of ambiguity, it uses the correct kzalloc.
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
diff --git a/include/linux/mtd/compat.h b/include/linux/mtd/compat.h
index 9036b74..840de4c 100644
--- a/include/linux/mtd/compat.h
+++ b/include/linux/mtd/compat.h
@@ -18,7 +18,12 @@
#define KERN_DEBUG
#define kmalloc(size, flags) malloc(size)
-#define kzalloc(size, flags) calloc(size, 1)
+#define kzalloc(size, flags) ({ \
+ void *__ret = malloc(size); \
+ if (__ret) \
+ memset(__ret, 0, size); \
+ __ret; \
+})
#define vmalloc(size) malloc(size)
#define kfree(ptr) free(ptr)
#define vfree(ptr) free(ptr)
next reply other threads:[~2008-10-06 2:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-06 2:20 Kyungmin Park [this message]
2008-10-06 7:28 ` [U-Boot] [PATCH] Use correct kzalloc Wolfgang Denk
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=20081006022028.GA5522@july \
--to=kmpark@infradead.org \
--cc=u-boot@lists.denx.de \
/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