On Mon, Dec 16, 2013 at 1:32 PM, John Stultz <john.stu...@linaro.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 majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/