[lkml]   [2007]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] slab: deal with NULL pointers passed to kmem_cache_free
On Mon, 19 Mar 2007, Matt Mackall wrote:

> I think this sort of thing should work:
> a = kmalloc(...)
> b = kmem_cache_alloc(..)
> c = allocate_some_id(...)
> if (!a || !b || !c) {
> free_some_id(c)
> kmem_cache_free(c)

^^^^ this requires the specification of a kmem_cache structure and the
object must be allocated by that cache.

> kfree(a);

Here we dynamically determine the slab cache and do not verify even which
slab it came from.

So you can always use kfree if you do not care. kmem_cache_free verifies
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2007-03-19 22:19    [W:0.080 / U:2.608 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site