Won't work for none GFP_ZERO memory.
...
> continue;
> - return __kmem_cache_alloc(csizep->cs_cachep, flags);
> +
> + mem = __kmem_cache_alloc(csizep->cs_cachep, flags);
> +
> + if (mem && (flags & GFP_ZERO)) {
> + memset (mem, 0, size);
> + goto out;
> + }
should be:
if ((flags & GFP_ZERO) && mem)
memset (mem, 0, size);
goto out;
> }
> printk(KERN_ERR "kmalloc: Size (%lu) too large\n", (unsigned long) size);
> - return NULL;
> +out:
> + return mem;
> }
And I think a "return mem;" instead of "goto out;" 'll have a better
performance, you don't need to init mem then (return NULL after printk
again).
Karsten
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/