mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH] sched: add sanity check in partition_sched_domains()
Date: Tue, 4 Nov 2008 10:28:48 +0100	[thread overview]
Message-ID: <20081104092848.GM23790@elte.hu> (raw)
In-Reply-To: <491005C7.2080608@cn.fujitsu.com>


* 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

  reply	other threads:[~2008-11-04  9:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-04  8:20 Li Zefan
2008-11-04  9:28 ` Ingo Molnar [this message]
2008-11-04 10:06   ` Li Zefan

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=20081104092848.GM23790@elte.hu \
    --to=mingo@elte.hu \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    /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®