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)
Fri, Oct 10, 1:50 PM
Unknown Object (File)
Sat, Sep 13, 7:18 AM
Unknown Object (File)
Aug 16 2025, 10:34 PM
Unknown Object (File)
Jul 6 2025, 10:20 PM
Unknown Object (File)
Jun 27 2025, 3:58 AM
Unknown Object (File)
Jun 26 2025, 1:46 AM
Unknown Object (File)
Jun 21 2025, 10:38 AM
Unknown Object (File)
May 17 2025, 6:03 PM
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.