The thorny case of kmalloc(0)
Posted Jun 8, 2007 16:05 UTC (Fri) by giraffedata
In reply to: The thorny case of kmalloc(0)
Parent article: The thorny case of kmalloc(0)
the ASSERT only happens when ...
Grrr. The ASSERT always "happens" -- it's right there in unconditional code. The assertion fails only when ...
And really, it shouldn't even be discussed. If you're asserting that the pointer is not null, that means you're assuming for simplicity that the the allocation didn't fail and if you discuss the possibility that it did fail, you've defeated the purpose of the assertion. This code should probaby be instead an explicit test of the pointer for NULL.
to post comments)