[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMbhsRRMMMreYzLMZHxjrRrKj0rZdS5SjLNbpGUuW93mg+Q65w@mail.gmail.com>
Date: Mon, 16 Dec 2013 16:26:28 -0800
From: Colin Cross <ccross@...roid.com>
To: John Stultz <john.stultz@...aro.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Greg KH <gregkh@...uxfoundation.org>,
Android Kernel Team <kernel-team@...roid.com>,
kbuild test robot <fengguang.wu@...el.com>
Subject: Re: [RFC][PATCH 2/3] staging: ion: Fix possible null pointer dereference
On Mon, Dec 16, 2013 at 1:32 PM, John Stultz <john.stultz@...aro.org> 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.
Returning NULL is fine, there is no reason the kmalloc is going to
succeed if it retries, and it will just have to allocate more of them
if it starts fulfilling the allocation with smaller order chunks.
Allocating the struct before entering the loop might make error handling easier.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists