lkml.org 
[lkml]   [2024]   [Apr]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mm/slab: make __free(kfree) accept error pointers
On Mon, 29 Apr 2024, Dan Carpenter wrote:

> I've always thought freeing pointers that have not been allocated is
> sloppy so I like that kfree() doesn't allow error pointers. We always
> catch it before it reaches production and that teaches people better
> habbits. Personally, I like how free_netdev() only accepts valid
> pointers.

kfree() already checks for NULL and ZERO pointers. We should add these
checks in *one* location.

Maybe issue a WARN_ONCE() and simply treat it as a NULL pointer if an
error code is passed?

\
 
 \ /
  Last update: 2024-05-27 18:08    [W:2.336 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site