mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] kmemleak: Check for NULL pointer returned by create_object()
Date: Fri, 9 Oct 2009 06:55:11 -0700	[thread overview]
Message-ID: <20091009135511.GB7893@linux.vnet.ibm.com> (raw)
In-Reply-To: <20091009093034.4365.34259.stgit@pc1117.cambridge.arm.com>

On Fri, Oct 09, 2009 at 10:30:34AM +0100, Catalin Marinas wrote:
> This patch adds NULL pointer checking in the early_alloc() function.

Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

> Reported-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> ---
>  mm/kmemleak.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/mm/kmemleak.c b/mm/kmemleak.c
> index a617518..8bf765c 100644
> --- a/mm/kmemleak.c
> +++ b/mm/kmemleak.c
> @@ -834,11 +834,14 @@ static void early_alloc(struct early_log *log)
>  	rcu_read_lock();
>  	object = create_object((unsigned long)log->ptr, log->size,
>  			       log->min_count, GFP_ATOMIC);
> +	if (!object)
> +		goto out;
>  	spin_lock_irqsave(&object->lock, flags);
>  	for (i = 0; i < log->trace_len; i++)
>  		object->trace[i] = log->trace[i];
>  	object->trace_len = log->trace_len;
>  	spin_unlock_irqrestore(&object->lock, flags);
> +out:
>  	rcu_read_unlock();
>  }
> 
> 

  parent reply	other threads:[~2009-10-09 13:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-09  9:30 [PATCH 1/2] kmemleak: Use GFP_ATOMIC for early_alloc() Catalin Marinas
2009-10-09  9:30 ` [PATCH 2/2] kmemleak: Check for NULL pointer returned by create_object() Catalin Marinas
2009-10-09 12:16   ` Pekka Enberg
2009-10-09 13:55   ` Paul E. McKenney [this message]
2009-10-09  9:37 ` [PATCH 1/2] kmemleak: Use GFP_ATOMIC for early_alloc() Catalin Marinas
2009-10-09  9:39 ` [PATCH] " Catalin Marinas

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=20091009135511.GB7893@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=catalin.marinas@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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

Powered by JetHome