The thorny case of kmalloc(0)
Posted Jun 7, 2007 10:58 UTC (Thu) by dvrabel
In reply to: The thorny case of kmalloc(0)
Parent article: The thorny case of kmalloc(0)
No. Either: a) you wanted a zero-size allocation know not to use the pointer; or b) the zero size allocation was a bug and should be detected as a error that's distinct from a out of memory error (i.e., any attempted use should fault).
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.
to post comments)