ranges: fix error pointer handling cross compiling on 32 bit systems
There are a few related fixes in this commit. Smatch was doing stuff like:
sval.uvalue >= -4905ULL
Where it should have been casted to the long of the system we are compiling
for. if (sval_cmp(sval, valid_ptr_max_sval) > 0) {.
The other thing is that Smatch sort of treats error pointers as negatives.
Obviously they aren't but it's nicer from a UI perspective to print -12
for -ENOMEM instead of
18446744073709551604. So I fixed that up as well.
It required writing a little sign_extend_err_ptr() function.
And then that required a fixup when we're reading -12 back from the DB
that it gets translated back into the correct value. This was in
parse_val().
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>