diff options
author | 2021-06-11 18:10:38 +0100 | |
---|---|---|
committer | 2021-06-15 12:49:23 +1000 | |
commit | ecfb438c07fa468a129e81c7d84c7c293c7b0150 (patch) | |
tree | 474a96104af9cef80245f0498a398620d5371cc3 /tests/integer-expressions.c | |
parent | 5bec74a6d13519381a40b5433ede7849a75a8d79 (diff) |
dtc: Fix signedness comparisons warnings: pointer diff
With -Wsign-compare, compilers warn about a mismatching signedness
in comparisons in the function get_node_by_path().
Taking the difference between two pointers results in a signed ptrdiff_t
type, which mismatches the unsigned type returned by strlen().
Since "p" has been returned by a call to strchr() with "path" as its
argument, we know for sure that it's bigger than "path", so the
difference must be positive. So a cast to an unsigned type is valid.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Message-Id: <20210611171040.25524-7-andre.przywara@arm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'tests/integer-expressions.c')
0 files changed, 0 insertions, 0 deletions