Page MenuHomeFreeBSD

libdtrace: Fix an off-by-one in the priority queue implementation
ClosedPublic

Authored by markj on Wed, Mar 5, 10:59 AM.
Tags
None
Referenced Files
F112562861: D49242.diff
Wed, Mar 19, 9:18 PM
Unknown Object (File)
Mon, Mar 10, 3:04 AM
Unknown Object (File)
Sat, Mar 8, 9:53 AM
Unknown Object (File)
Fri, Mar 7, 5:01 AM
Unknown Object (File)
Fri, Mar 7, 4:20 AM
Unknown Object (File)
Thu, Mar 6, 7:11 PM
Unknown Object (File)
Thu, Mar 6, 4:16 PM
Subscribers

Details

Summary

The zero'th index in the array is unused, so a priority queue of N elements
needs N+1 array slots. Fix the allocation.

Also fix the assertion in dt_pq_insert(): the assertion needs to be checked
after incrementing the count of items in the priority queue, otherwise it can
miss an overflow.

Reported by: CHERI
Sponsored by: Innovate UK

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 62768
Build 59652: arc lint + arc unit