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)
Fri, Oct 25, 5:19 AM
Unknown Object (File)
Oct 7 2024, 8:04 AM
Unknown Object (File)
Oct 7 2024, 8:03 AM
Unknown Object (File)
Oct 7 2024, 8:03 AM
Unknown Object (File)
Oct 7 2024, 8:03 AM
Unknown Object (File)
Oct 7 2024, 8:02 AM
Unknown Object (File)
Oct 7 2024, 7:32 AM
Unknown Object (File)
Sep 22 2024, 7:23 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.