ranges: fix error pointer handling cross compiling on 32 bit systems
commit3e5533561987236da0158b631ac027a462a789c7
authorDan Carpenter <dan.carpenter@linaro.org>
Thu, 5 Oct 2023 15:34:35 +0000 (5 18:34 +0300)
committerDan Carpenter <dan.carpenter@linaro.org>
Thu, 5 Oct 2023 15:34:35 +0000 (5 18:34 +0300)
tree7ac7c5c9ba2d2e931fd470c0a1653e7610457d81
parent69b065109638254604fe965a6983d53ff404f77f
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>
check_checking_for_null_instead_of_err_ptr.c
smatch_extra.h
smatch_ranges.c
smatch_sval.c