From: Tanner Love <tannerlove.kernel@gmail•com>
To: netdev@vger•kernel.org
Cc: davem@davemloft•net, Tanner Love <tannerlove@google•com>,
Willem de Bruijn <willemb@google•com>
Subject: [PATCH net 4/4] selftests/net: tcp_mmap: fix clang warning for target arch PowerPC
Date: Mon, 27 Jul 2020 12:25:31 -0400 [thread overview]
Message-ID: <20200727162531.4089654-5-tannerlove.kernel@gmail.com> (raw)
In-Reply-To: <20200727162531.4089654-1-tannerlove.kernel@gmail.com>
From: Tanner Love <tannerlove@google•com>
When size_t maps to unsigned int (e.g. on 32-bit powerpc), then the
comparison with 1<<35 is always true. Clang 9 threw:
warning: result of comparison of constant 34359738368 with \
expression of type 'size_t' (aka 'unsigned int') is always true \
[-Wtautological-constant-out-of-range-compare]
while (total < FILE_SZ) {
Tested: make -C tools/testing/selftests TARGETS="net" run_tests
Fixes: 192dc405f308 ("selftests: net: add tcp_mmap program")
Signed-off-by: Tanner Love <tannerlove@google•com>
Acked-by: Willem de Bruijn <willemb@google•com>
---
tools/testing/selftests/net/tcp_mmap.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/net/tcp_mmap.c b/tools/testing/selftests/net/tcp_mmap.c
index 4555f88252ba..a61b7b3da549 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;
+ uint64_t total = 0;
char *host = NULL;
int fd, c, on = 1;
char *buffer;
@@ -473,12 +473,12 @@ int main(int argc, char *argv[])
zflg = 0;
}
while (total < FILE_SZ) {
- ssize_t wr = FILE_SZ - total;
+ int64_t wr = FILE_SZ - total;
if (wr > chunk_size)
wr = chunk_size;
/* Note : we just want to fill the pipe with 0 bytes */
- wr = send(fd, buffer, wr, zflg ? MSG_ZEROCOPY : 0);
+ wr = send(fd, buffer, (size_t)wr, zflg ? MSG_ZEROCOPY : 0);
if (wr <= 0)
break;
total += wr;
--
2.28.0.rc0.142.g3c755180ce-goog
next prev parent reply other threads:[~2020-07-27 16:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-27 16:25 [PATCH net 0/4] selftests/net: Fix clang warnings on powerpc Tanner Love
2020-07-27 16:25 ` [PATCH net 1/4] selftests/net: rxtimestamp: fix clang issues for target arch PowerPC Tanner Love
2020-07-27 16:25 ` [PATCH net 2/4] selftests/net: psock_fanout: " Tanner Love
2020-07-27 16:25 ` [PATCH net 3/4] selftests/net: so_txtime: " Tanner Love
2020-07-27 16:25 ` Tanner Love [this message]
2020-07-27 19:33 ` [PATCH net 4/4] selftests/net: tcp_mmap: fix clang warning " Eric Dumazet
2020-07-27 19:57 ` [PATCH net 0/4] selftests/net: Fix clang warnings on powerpc David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200727162531.4089654-5-tannerlove.kernel@gmail.com \
--to=tannerlove.kernel@gmail$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
--cc=tannerlove@google$(echo .)com \
--cc=willemb@google$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox