The thorny case of kmalloc(0)
Posted Jun 7, 2007 11:17 UTC (Thu) by
evgeny (guest, #774)
In reply to:
The thorny case of kmalloc(0) by dvrabel
Parent article:
The thorny case of kmalloc(0)
> If you wish to defensively program a function against a caller requesting zero-sized allocations it would be better to test before attempting the allocation.
Well, that's the right way in my opinion. It needs only one check per kmalloc() call, while using two flavors of NULL forces to implement this check for each (out of, in general, >= 1 cases) access to pointer.
(
Log in to post comments)