IMHO, it doesn't really make sense to mix and match between knlist_mtx_{,un,assert_}lock and other functions filling those roles, unless all three are replaced (e.g., by knlist_rw_{,un,assert_}lock), so it's a little strange that knlist_init() allows its function pointer parameters to be NULL or not, independently. Indeed, glancing at all the in-tree knlist_init() calls, it appears that only knlist_init_mtx() took knlist_init() up on its offer of NULL-signaled defaults. Instead, explicitly pass in the _mtx variants in knlist_init_mtx() and assert() against NULL values in knlist_init().
Details
Details
Diff Detail
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
Comment Actions
Can you please send me the git send-email prepared patch, with proper commit message and attributions (e.g. right author name/email), ready for commit?
sys/kern/kern_event.c | ||
---|---|---|
2421 | We usually do not assert that pointers are not NULL, allowing them to simply fault on dereference. Otherwise, half of our code would consist of non-NULL asserts. That said, I can see an argument that there it allows to see the place where the harm was done. At least, please fix the continuation line to have +4 spaces assert. |