Re: [PATCH] net: ocelot_board: fix a NULL pointer dereference
From: David Miller
Date: Mon Mar 11 2019 - 13:39:43 EST
From: Eric Dumazet <eric.dumazet@xxxxxxxxx>
Date: Mon, 11 Mar 2019 07:14:58 -0700
>
>
> On 03/11/2019 03:26 AM, Alexandre Belloni wrote:
>> On 11/03/2019 01:36:32-0500, Kangjie Lu wrote:
>>> In case devm_kcalloc fails, the fix returns -ENOMEM to avoid
>>> NULL pointer dereference.
>>>
>>> Signed-off-by: Kangjie Lu <kjlu@xxxxxxx>
>> Reviewed-by: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>
>>
>
> A proper error path is needed to avoid memory leaks.
This seems to be a major chronic problem with all of these patches.
Kangjie please put more care into the patches you are submitting.
You absolutely CANNOT just add a error check and return, you must
handle releasing resources and any other necessary cleanups.