[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <52AF9CB7.90003@linaro.org>
Date: Mon, 16 Dec 2013 16:37:11 -0800
From: John Stultz <john.stultz@...aro.org>
To: Colin Cross <ccross@...roid.com>
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 12/16/2013 04:26 PM, Colin Cross wrote:
> 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.
Ok, I had actually done that in my first pass, but then got worried the
allocation/free might have extra overhead in the case where the pool is
exhausted, so I stuck with the existing pattern. But if that's not a
common state, then I agree, it does make the handling simpler.
I'll rework this and re-submit. Thanks for the feedback!
thanks
-john
--
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