Re: [PATCH 1/3] kernel/trace/trace.c: introduce missing kfree

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Ingo Molnar
Date: Wednesday, November 19, 2008 - 1:52 am

* Andrew Morton <akpm@linux-foundation.org> wrote:


it's in tip/tracing/urgent:

  0bb943c: tracing: kernel/trace/trace.c: introduce missing kfree()


agreed, it's messy. At minimum the ordering is wrong: it should not 
return the iterator but 'ret' - the _iterator_ value can then be a 
side-effect (dependent on the return value being fine).

the usage site clearly shows the problem:

static int tracing_open(struct inode *inode, struct file *file)
{
        int ret;

        __tracing_open(inode, file, &ret);

        return ret;
}

that could then be a simple:

static int tracing_open(struct inode *inode, struct file *file)
{
        return __tracing_open(inode, file, NULL);
}

and we wouldnt allocate an iterator if the iter ptr is NULL. (which we 
seem to leak in tracing_open() right now!)

	Ingo
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 1/3] kernel/trace/trace.c: introduce missing kfree, Julia Lawall, (Fri Nov 14, 11:05 am)
Re: [PATCH 1/3] kernel/trace/trace.c: introduce missing kfree, Ingo Molnar, (Wed Nov 19, 1:52 am)