mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@cs.helsinki.fi>
To: dtor_core@ameritech.net
Cc: pmarques@grupopie.com, tiwai@suse.de, akpm@osdl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 8/8] ALSA: convert kcalloc to kzalloc
Date: Sat, 06 Aug 2005 15:52:35 +0300	[thread overview]
Message-ID: <1123332756.11074.10.camel@haji.ri.fi> (raw)
In-Reply-To: <d120d5000508050822f18c9ac@mail.gmail.com>

On Fri, 2005-08-05 at 10:22 -0500, Dmitry Torokhov wrote:
> On 8/5/05, Pekka Enberg <penberg@cs.helsinki.fi> wrote:
> > This patch converts kcalloc(1, ...) calls to use the new kzalloc() function.
> > 
> 
> Hi,
> 
> Have you seen the following in include/sound/core?
> 
> ...
> #define kmalloc(size, flags) snd_hidden_kmalloc(size, flags)
> #define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags)
> #define kfree(obj) snd_hidden_kfree(obj)

Thanks for the catch, Dmitry.

			Pekka

[PATCH] ALSA: introduce snd_hidden_kzalloc

This patch introduces a memory-leak tracking version of kzalloc for ALSA.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---

 include/sound/core.h |    2 ++
 sound/core/memory.c  |   13 +++++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

Index: 2.6/include/sound/core.h
===================================================================
--- 2.6.orig/include/sound/core.h
+++ 2.6/include/sound/core.h
@@ -291,12 +291,14 @@ void snd_memory_done(void);
 int snd_memory_info_init(void);
 int snd_memory_info_done(void);
 void *snd_hidden_kmalloc(size_t size, unsigned int __nocast flags);
+void *snd_hidden_kzalloc(size_t size, unsigned int __nocast flags);
 void *snd_hidden_kcalloc(size_t n, size_t size, unsigned int __nocast flags);
 void snd_hidden_kfree(const void *obj);
 void *snd_hidden_vmalloc(unsigned long size);
 void snd_hidden_vfree(void *obj);
 char *snd_hidden_kstrdup(const char *s, unsigned int __nocast flags);
 #define kmalloc(size, flags) snd_hidden_kmalloc(size, flags)
+#define kzalloc(size, flags) snd_hidden_kzalloc(size, flags)
 #define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags)
 #define kfree(obj) snd_hidden_kfree(obj)
 #define vmalloc(size) snd_hidden_vmalloc(size)
Index: 2.6/sound/core/memory.c
===================================================================
--- 2.6.orig/sound/core/memory.c
+++ 2.6/sound/core/memory.c
@@ -116,15 +116,20 @@ void *snd_hidden_kmalloc(size_t size, un
 	return _snd_kmalloc(size, flags);
 }
 
+void *snd_hidden_kzalloc(size_t size, unsigned int __nocast flags)
+{
+	void *ret = _snd_kmalloc(size, flags);
+	if (ret)
+		memset(ret, 0, size);
+	return ret;
+}
+
 void *snd_hidden_kcalloc(size_t n, size_t size, unsigned int __nocast flags)
 {
 	void *ret = NULL;
 	if (n != 0 && size > INT_MAX / n)
 		return ret;
-	ret = _snd_kmalloc(n * size, flags);
-	if (ret)
-		memset(ret, 0, n * size);
-	return ret;
+	return snd_hidden_kzalloc(n * size, flags);
 }
 
 void snd_hidden_kfree(const void *obj)



      parent reply	other threads:[~2005-08-06 12:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-05 14:50 [PATCH 0/8] " Pekka Enberg
2005-08-05 14:50 ` [PATCH 1/8] IA64: " Pekka Enberg
2005-08-05 14:50   ` [PATCH 2/8] PPC64: " Pekka Enberg
2005-08-05 14:51     ` [PATCH 3/8] input: " Pekka Enberg
2005-08-05 14:51       ` [PATCH 4/8] USB: " Pekka Enberg
2005-08-05 14:51         ` [PATCH 5/8] PCI: " Pekka Enberg
2005-08-05 14:51           ` [PATCH 6/8] drivers: " Pekka Enberg
2005-08-05 14:51             ` [PATCH 7/8] fs: " Pekka Enberg
2005-08-05 14:52               ` [PATCH 8/8] ALSA: " Pekka Enberg
2005-08-05 15:22                 ` Dmitry Torokhov
2005-08-05 16:10                   ` Paulo Marques
2005-08-06 12:37                     ` Pekka Enberg
2005-08-08 10:20                       ` Takashi Iwai
2005-08-06 12:52                   ` Pekka Enberg [this message]

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=1123332756.11074.10.camel@haji.ri.fi \
    --to=penberg@cs.helsinki.fi \
    --cc=akpm@osdl.org \
    --cc=dtor_core@ameritech.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmarques@grupopie.com \
    --cc=tiwai@suse.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

all inboxes | Powered by JetHome®