Just as an anecdote - I built a variant of container_of to protect against
cases where NULL can creep in:
#define test_container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__p = (ptr); \
__p ? container_of(__p, type, member) : NULL;})
It calls the real container_of only if 'ptr' is not NULL.
-Kevin
-- ------------------------------------------------------------------------ | Kevin O'Connor "BTW, IMHO we need a FAQ for | | kevin@koconnor.net 'IMHO', 'FAQ', 'BTW', etc. !" | ------------------------------------------------------------------------ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/