Page MenuHomeFreeBSD

aio_kqueue_test: Fix CID 1558429
AcceptedPublic

Authored by dab on Sun, Jan 5, 7:59 PM.
Tags
None
Referenced Files
F106980456: D48328.diff
Wed, Jan 8, 11:14 AM
Unknown Object (File)
Mon, Jan 6, 2:17 PM
Subscribers

Details

Summary

Fix a Coverity error in the aio_kqueue_test that could theoretically
(but probably not realistically) cause over-indexing an array.

Test Plan

Ran test on local system; passed.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 61512
Build 58396: arc lint + arc unit

Event Timeline

dab held this revision as a draft.
dab edited the summary of this revision. (Show Details)

Typo correction

dab published this revision for review.Sun, Jan 5, 8:05 PM

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.

This revision is now accepted and ready to land.Mon, Jan 6, 1:59 PM

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.

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.