The thorny case of kmalloc(0)
Posted Jun 8, 2007 0:41 UTC (Fri) by bronson
In reply to: The thorny case of kmalloc(0)
Parent article: The thorny case of kmalloc(0)
The article gives a perfectly good reason why kmalloc(0) is a decent thing to do: when the config has resulted in a struct with 0 members. Much easier just to kmalloc(0) and continue as normal rather than scattering more #ifdefs or macros everywhere.
(there's no need to test for ZERO_SIZE_PTR in this case because the struct has no members so the pointer can not be dereferenced anyway; you'll get a compile-time error instead of an oops)
to post comments)