On 7/24/20 11:17 AM, Tanner Love wrote:
> From: Tanner Love <tannerl...@google.com>
>
> Address these warnings observed with clang 9.
>
>
> tcp_mmap:
> Compilation yielded:
> warning: result of comparison of constant 34359738368 with \
> expression of type 'size_t' (aka 'unsigned int') is always true \
size_t is not generally 'unsigned int', not sure how you get this ?
> [-Wtautological-constant-out-of-range-compare]
> while (total < FILE_SZ) {
>
> Tested: make -C tools/testing/selftests TARGETS="net" run_tests
>
>
> diff --git a/tools/testing/selftests/net/tcp_mmap.c
> b/tools/testing/selftests/net/tcp_mmap.c
> index 4555f88252ba..92086d65bd87 100644
> --- a/tools/testing/selftests/net/tcp_mmap.c
> +++ b/tools/testing/selftests/net/tcp_mmap.c
> @@ -344,7 +344,7 @@ int main(int argc, char *argv[])
> {
> struct sockaddr_storage listenaddr, addr;
> unsigned int max_pacing_rate = 0;
> - size_t total = 0;
> + unsigned long total = 0;
> char *host = NULL;
> int fd, c, on = 1;
> char *buffer;
>
This will break on 32bit arches, where sizeof(unsigned long) == 4