Re: [PATCH] netlink: Fix kfree NULL pointer

From: Eric W. Biederman
Date: Wed Sep 08 2010 - 01:55:12 EST


jovi zhang <bookjovi@xxxxxxxxx> writes:

> On Wed, Sep 8, 2010 at 1:19 PM, Eric Dumazet <eric.dumazet@xxxxxxxxx> wrote:
>>
>>
>> This patch is not needed
>>
>> kfree(NULL) is legal
>>
>>
>>
>>
>
> YES, maybe kfree(NULL) is legal, but I cannot see there have any need
> to invoke kfree(NULL) in this function.
> ÂAlso I check kfree usage in other code, I havn't find any kfree(NULL)
> usage.

Usually kfree(NULL) is not explicit, but "var = NULL; kfree(var)" is
common in error handling paths to reduce the complexity of error
handling, making bugs less likely.


Eric

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/