From: Masami Hiramatsu <mhiramat@kernel.org>
To: Shuah Khan <shuah@kernel.org>
Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
jaswinder.singh@linaro.org, Eric Dumazet <edumazet@google.com>,
"David S . Miller" <davem@davemloft.net>
Subject: [BUGFIX PATCH 3/5] selftests: net: Use size_t and ssize_t for counting file size
Date: Tue, 8 Oct 2019 00:10:45 +0900 [thread overview]
Message-ID: <157046104535.20724.6659308145965966926.stgit@devnote2> (raw)
In-Reply-To: <157046101671.20724.9561877942986463668.stgit@devnote2>
Use size_t and ssize_t correctly for counting send file size
instead of unsigned long and long, because long is 32bit on
32bit arch, which is not enough for counting long file size (>4GB).
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Eric Dumazet <edumazet@google.com>
Cc: David S. Miller <davem@davemloft.net>
---
tools/testing/selftests/net/tcp_mmap.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/net/tcp_mmap.c b/tools/testing/selftests/net/tcp_mmap.c
index 31ced79f4f25..33035d1b3f6d 100644
--- a/tools/testing/selftests/net/tcp_mmap.c
+++ b/tools/testing/selftests/net/tcp_mmap.c
@@ -71,7 +71,7 @@
#define MSG_ZEROCOPY 0x4000000
#endif
-#define FILE_SZ (1UL << 35)
+#define FILE_SZ (1ULL << 35)
static int cfg_family = AF_INET6;
static socklen_t cfg_alen = sizeof(struct sockaddr_in6);
static int cfg_port = 8787;
@@ -155,7 +155,7 @@ void *child_thread(void *arg)
socklen_t zc_len = sizeof(zc);
int res;
- zc.address = (__u64)addr;
+ zc.address = (__u64)((unsigned long)addr);
zc.length = chunk_size;
zc.recv_skip_hint = 0;
res = getsockopt(fd, IPPROTO_TCP, TCP_ZEROCOPY_RECEIVE,
@@ -302,7 +302,7 @@ int main(int argc, char *argv[])
{
struct sockaddr_storage listenaddr, addr;
unsigned int max_pacing_rate = 0;
- unsigned long total = 0;
+ size_t total = 0;
char *host = NULL;
int fd, c, on = 1;
char *buffer;
@@ -417,7 +417,7 @@ int main(int argc, char *argv[])
zflg = 0;
}
while (total < FILE_SZ) {
- long wr = FILE_SZ - total;
+ ssize_t wr = FILE_SZ - total;
if (wr > chunk_size)
wr = chunk_size;
next prev parent reply other threads:[~2019-10-07 15:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-07 15:10 [BUGFIX PATCH 0/5] selftests: Fixes for 32bit arch Masami Hiramatsu
2019-10-07 15:10 ` [BUGFIX PATCH 1/5] selftests: proc: Make va_max 3GB on " Masami Hiramatsu
2019-10-08 17:59 ` Alexey Dobriyan
2019-10-09 2:49 ` Masami Hiramatsu
2019-10-07 15:10 ` [BUGFIX PATCH 2/5] selftests: vm: Build/Run 64bit tests only on 64bit arch Masami Hiramatsu
2019-10-07 15:10 ` Masami Hiramatsu [this message]
2019-10-07 15:10 ` [BUGFIX PATCH 4/5] selftests: net: Fix printf format warnings on arm Masami Hiramatsu
2019-10-07 15:11 ` [BUGFIX PATCH 5/5] selftests: sync: Fix cast " Masami Hiramatsu
2019-10-18 21:45 ` [BUGFIX PATCH 0/5] selftests: Fixes for 32bit arch shuah
2019-10-21 7:24 ` Masami Hiramatsu
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=157046104535.20724.6659308145965966926.stgit@devnote2 \
--to=mhiramat@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jaswinder.singh@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.