Fix a Coverity error in the aio_kqueue_test that could theoretically
(but probably not realistically) cause over-indexing an array.
Details
Details
- Reviewers
ngie vangyzen asomers - Commits
- rG7c94d515db90: aio_kqueue_test: Fix CID 1558429
Ran test on local system; passed.
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
I think this is OK. But it would also be fine just to put an assert(j < max_queue_per_proc before the array dereference.
Comment Actions
That was actually my first inclination, but didn't know if it was better to have the explicit message and let the test fail gracefully rather than have it abort on an assert.
Doing an assert would certainly be more straightforward and perhaps more clearly indicate that this is a scenario that should not ever happen.
I think I'll take your suggestion and revise this to use the assert method.
Comment Actions
Coverity often surprises me, in both cleverness and ignorance. I suppose the same can be said of all software, and indeed, of most human pursuits.