Page MenuHomeFreeBSD

libthr: Do not rely on UB in counter
ClosedPublic

Authored by aokblast on Wed, Oct 7, 1:44 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 8, 8:31 AM
Unknown Object (File)
Thu, Oct 8, 6:57 AM
Unknown Object (File)
Thu, Oct 8, 3:52 AM
Unknown Object (File)
Thu, Oct 8, 3:49 AM
Unknown Object (File)
Thu, Oct 8, 3:36 AM
Unknown Object (File)
Thu, Oct 8, 2:55 AM
Unknown Object (File)
Wed, Oct 7, 11:38 PM
Unknown Object (File)
Wed, Oct 7, 6:46 PM
Subscribers

Details

Summary

counter + 1 > 0 is a undefined behavior and nobody guarantee that it
will be honestly perform by the compiler that counter + 1 will always be
INT_MIN. We switch to INT_MAX check instead to provide a deterministic
result.

Diff Detail

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