| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
o Fix range error checking to detect overflow when uint64_t < uintmax_t.
o Remove a non-functional check for no valid digits as pointed out by Bruce.
o Remove a rather pointless comment describing what the function does.
o Clean up a bunch of style bugs.
Brucified by: bde
|
|
|
|
|
|
|
|
| |
Restore saved errno if strtoumax() call is successful.
Reported by: ache
Reviewed by: jilles
MFC after: 1 week
|
|
|
|
|
| |
OK'd by: silence on current@
MFC after: 1 week
|
|
|
|
| |
Submitted by: Christoph Mallon <christoph.mallon@gmx.de>
|
|
|
|
|
|
|
|
|
| |
a very bad one, since the shift does not actually overflow. This is
a better example (assuming uint64_t = unsigned long long):
~0LLU >> 9 = 0x7fffffffffffffLLU
~0LLU >> 9 << 10 = 0xfffffffffffffc00LLU
~0LLU >> 9 << 10 >> 10 = 0x3fffffffffffffLLU
|
|
|
|
|
|
|
| |
overflowing shift to be larger than the original value, e.g.
(uint64_t)1 << 53 = 0x20000000000000
((uint64_t)1 << 53) << 10 = 0x8000000000000000
|
|
|
|
|
|
|
| |
switch. Since expand_number() does not accept negative numbers, switch
from int64_t to uint64_t; this makes it easier to check for overflow.
MFC after: 3 weeks
|
|
|
|
|
| |
Submitted by: Jilles Tjoelker <jilles stack nl>
MFC after: 3 days
|
|
|
|
| |
be called with a const without the compiler grisling.
|
|
|
|
|
|
|
|
|
| |
Reported by: phk
- While here, check the unit before calculating the actually number.
This way we can return EINVAL for invalid unit instead of ERANGE.
Approved by: re (kensmith)
|
|
a number in human-readable form is converted to int64_t, for example:
123b -> 123
10k -> 10240
16G -> 17179869184
First version submitted by: Eric Anderson <anderson@freebsd.org>
Approved by: re (bmah)
|