public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: John Stultz <john.stultz@linaro.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Colin Cross <ccross@android.com>,
	Android Kernel Team <kernel-team@android.com>,
	kbuild test robot <fengguang.wu@intel.com>
Subject: Re: [RFC][PATCH 2/3] staging: ion: Fix possible null pointer dereference
Date: Mon, 16 Dec 2013 13:40:26 -0800	[thread overview]
Message-ID: <20131216214026.GA21685@kroah.com> (raw)
In-Reply-To: <1387229564-19517-3-git-send-email-john.stultz@linaro.org>

On Mon, Dec 16, 2013 at 01:32:43PM -0800, John Stultz wrote:
> The kbuild test robot reported:
> 
> drivers/staging/android/ion/ion_system_heap.c:122 alloc_largest_available() error: potential null dereference 'info'.  (kmalloc returns null)
> 
> Where the pointer returned from kmalloc goes unchecked for failure.
> 
> This patch adds a simple check for a null return, and handles the error.
> 
> XXX: Not sure if continue or 'return NULL' is the right thing to do.
> 
> Cc: Colin Cross <ccross@android.com>
> Cc: Greg KH <gregkh@linuxfoundation.org>
> Cc: Android Kernel Team <kernel-team@android.com>
> Cc: kbuild test robot <fengguang.wu@intel.com>
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Signed-off-by: John Stultz <john.stultz@linaro.org>
> ---
>  drivers/staging/android/ion/ion_system_heap.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c
> index 144b2272..cc2e4da 100644
> --- a/drivers/staging/android/ion/ion_system_heap.c
> +++ b/drivers/staging/android/ion/ion_system_heap.c
> @@ -119,6 +119,11 @@ static struct page_info *alloc_largest_available(struct ion_system_heap *heap,
>  			continue;
>  
>  		info = kmalloc(sizeof(struct page_info), GFP_KERNEL);
> +		if(!info) {

Please don't add new coding style issues to staging drivers, the goal is
to clean them up, not make more mess :)

Care to resend this when you have figured out the XXX: line above?

thanks,

greg k-h

  reply	other threads:[~2013-12-16 21:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-16 21:32 [RFC][PATCH 0/3] ION fixups for staging-next John Stultz
2013-12-16 21:32 ` [RFC][PATCH 1/3] staging: ion: Add HAVE_MEMBLOCK config dependency John Stultz
2013-12-16 21:32 ` [RFC][PATCH 2/3] staging: ion: Fix possible null pointer dereference John Stultz
2013-12-16 21:40   ` Greg KH [this message]
2013-12-17  0:26   ` Colin Cross
2013-12-17  0:37     ` John Stultz
2013-12-16 21:32 ` [RFC][PATCH 3/3] staging: ion: Avoid using rt_mutexes directly John Stultz
2013-12-17  0:17   ` Colin Cross
2013-12-17  1:22     ` John Stultz
2013-12-17  1:34       ` Colin Cross

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=20131216214026.GA21685@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=ccross@android.com \
    --cc=fengguang.wu@intel.com \
    --cc=john.stultz@linaro.org \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.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