lkml.org 
[lkml]   [2008]   [Nov]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] sched: add sanity check in partition_sched_domains()

* Li Zefan <lizf@cn.fujitsu.com> wrote:

> It's wrong to make dattr_new = NULL if doms_new == NULL, it introduces
> memory leak if dattr_new != NULL. Fortunately dattr_new is always NULL
> in this case. So remove the code and add a sanity check.
>
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
> ---
> kernel/sched.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)

applied to tip/sched/core, thanks!

a small detail, i changed this:

> + BUG_ON(dattr_new);

to WARN_ON_ONCE().

If there's a rare setup-time memory leak we dont want to crash the box
via a BUG_ON(), as that only results in unhappy users. We want a
WARN_ON_ONCE() so that we get nice bugreports and kerneloops.org
coverage as well instead.

We use BUG_ON() in new code only in the rarest of circumstances: if we
absolutely want to bring down the box right there - because there's a
serious risk of data corruption, security breach, etc.

Ingo


\
 
 \ /
  Last update: 2008-11-04 10:31    [W:0.029 / U:0.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site