Page MenuHomeFreeBSD

remove heuristic error detection from ddi_strto*()
ClosedPublic

Authored by avg on Oct 2 2017, 12:19 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 20 2023, 1:46 AM
Unknown Object (File)
Nov 10 2023, 6:43 PM
Unknown Object (File)
Nov 9 2023, 11:02 AM
Unknown Object (File)
Nov 6 2023, 3:45 AM
Unknown Object (File)
Oct 9 2023, 5:43 PM
Unknown Object (File)
Oct 8 2023, 9:59 AM
Unknown Object (File)
Oct 5 2023, 2:39 AM
Unknown Object (File)
Sep 25 2023, 8:07 AM
Subscribers

Details

Summary

Zero, <TYPE>_MIN and <TYPE>_MAX values can result from valid conversions.
They don't necessarily signal any error.
Since we do not have any reliable error signalling from libkern's strto*(),
it's better to always assume success rather than to report an error when
there is none.

@tsoome suggested that for strtol and strtoul we can internally use
strtoq and strtouq, so that we can check a result for being within
the corresponding ranges. Not sure if it's worth the trouble.
There is no equivalent technique for strtoll and strtoull anyway.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

FWIW, this Oracle manual mentions only EINVAL because of an invalid conversion base.

This revision is now accepted and ready to land.Oct 2 2017, 2:11 PM
This revision was automatically updated to reflect the committed changes.