Page MenuHomeFreeBSD

Fix overflow errors in sbttous and sbttoms
ClosedPublic

Authored by asomers on Apr 6 2022, 8:07 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 30, 7:22 PM
Unknown Object (File)
Tue, Apr 30, 7:17 PM
Unknown Object (File)
Apr 8 2024, 1:32 PM
Unknown Object (File)
Feb 6 2024, 1:24 PM
Unknown Object (File)
Dec 29 2023, 1:06 AM
Unknown Object (File)
Dec 27 2023, 6:48 AM
Unknown Object (File)
Dec 20 2023, 7:15 AM
Unknown Object (File)
Dec 12 2023, 6:29 PM
Subscribers
None

Details

Summary

Both of these functions would overflow for very large inputs. Add tests
for them. Also, add tests for the inverse functions, *stosbt, whose
overflow errors were fixed by 4c30b9ecd47.

PR: 263073
MFC after: 1 week
Sponsored by: Axcient

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

asomers created this revision.

the sys/sys/time.h stuff looks good and matches what I was planning on (thanks!) and should be a separate commit.
I need to study the test cases a little more, but first blush they look like all the right sorts of tests.
Found one issue with our constant foe: printf format mismatches :)

tests/sys/sys/time_test.c
121

I don't think %ld will work on our 32-bit platforms for the SBT.
And it may be more useful to print it as a hex number.
likewise %ld won't work on int64_t on the 32-bit platforms.

  • 32-bit compatible printf format specifiers

Ping @imp . Do you think you could finish reviewing the tests sometime?

Generally, I like this. Couple of small nits, sorry for the delay.

tests/sys/sys/time_test.c
61

I'd do 4s as well, just to be paranoid.

86

ditto on the 4s here.

111

ditto

135

same comments here, and below, about 4s too.

162

where do these numbers come from? Can they be computed instead?

  • Add 4s tests and make some magic numbers less magical.

I think we're good. Thanks

This revision is now accepted and ready to land.May 9 2022, 9:59 PM
This revision was automatically updated to reflect the committed changes.