lkml.org 
[lkml]   [2008]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Possible mem leak in copy_process()

* Oleg Nesterov <oleg@tv-sign.ru> wrote:

> > 1331 if (likely(p->pid)) {

> > 1351 }

> > Event leaked_storage: Returned without freeing storage "pid" Also
> > see events: [alloc_fn][var_assign][pass_arg]
>
> this looks like a false alarm.
>
> p->pid == pid->numbers[0].nr. If "struct pid *pid" was allocated, its
> .nr can't be 0.
>
> IOW, !p->pid means that pid == init_struct_pid, it wasn't allocated
> but was passed from the caller.

should we perhaps codify this rule via adding something like this to the
else branch:

WARN_ON_ONCE(task_pid(p) != &init_struct_pid);

?

Ingo


\
 
 \ /
  Last update: 2008-04-17 15:05    [from the cache]
©2003-2011 Jasper Spaans