public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paulo Marques <pmarques@grupopie.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org
Subject: Re: [PATCH 2.6] 7/7 replace snd_kmalloc_strdup by kstrdup
Date: Tue, 01 Feb 2005 13:07:25 +0000	[thread overview]
Message-ID: <41FF7F0D.5080800@grupopie.com> (raw)
In-Reply-To: <s5hy8e8fol6.wl@alsa2.suse.de>

Takashi Iwai wrote:
> [...]
> The compile should be fine but it may result in memory corruption
> since kmalloc/kfree become wrappers when CONFIG_SND_DEBUG_MEMORY is
> set.  See include/sound/core.h.

Ok, I see what you mean. I'm sorry I've missed this, but you must admit 
that code like this:

> #define kmalloc(size, flags) snd_hidden_kmalloc(size, flags)
> #define kfree(obj) snd_hidden_kfree(obj)

in sound/core.h make the code really hard to read :P

I thought of going all the way and changing the callers of kstrdup in 
sound to use kfree, so that it would work without debugging memory 
allocated for strdup'ed strings.

However the code there already uses kfree, just not the standard kfree 
because it might have been defined to something else in core.h if 
CONFIG_SND_DEBUG_MEMORY is set.

We could still go all the way and carry on with this approach: use the 
standard kstrdup / kfree when not CONFIG_SND_DEBUG_MEMORY, and define 
kstrdup to be an internal sound function in sound/core/memory.c when 
CONFIG_SND_DEBUG_MEMORY is set.

Do you prefer that I do another patch to do this, or that I just drop 
the patch and leave snd_kmalloc_strdup alone?

-- 
Paulo Marques - www.grupopie.com

All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke (1729 - 1797)

  reply	other threads:[~2005-02-01 13:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-01  3:28 [PATCH 2.6] 7/7 replace snd_kmalloc_strdup by kstrdup pmarques
2005-02-01 11:17 ` Takashi Iwai
2005-02-01 12:27   ` Paulo Marques
2005-02-01 12:32     ` Takashi Iwai
2005-02-01 13:07       ` Paulo Marques [this message]
2005-02-01 13:16         ` Takashi Iwai
2005-02-01 15:39           ` Paulo Marques
2005-02-01 16:39             ` Takashi Iwai
2005-02-01 17:15               ` Paulo Marques
2005-02-02 11:29                 ` Takashi Iwai

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=41FF7F0D.5080800@grupopie.com \
    --to=pmarques@grupopie.com \
    --cc=akpm@osdl.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=linux-kernel@vger.kernel.org \
    --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