* [PATCH net 1/4] selftests/net: rxtimestamp: fix clang issues for target arch PowerPC
2020-07-27 16:25 [PATCH net 0/4] selftests/net: Fix clang warnings on powerpc Tanner Love
@ 2020-07-27 16:25 ` Tanner Love
2020-07-27 16:25 ` [PATCH net 2/4] selftests/net: psock_fanout: " Tanner Love
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Tanner Love @ 2020-07-27 16:25 UTC (permalink / raw)
To: netdev; +Cc: davem, Tanner Love, Willem de Bruijn
From: Tanner Love <tannerlove@google.com>
The signedness of char is implementation-dependent. Some systems
(including PowerPC and ARM) use unsigned char. Clang 9 threw:
warning: result of comparison of constant -1 with expression of type \
'char' is always true [-Wtautological-constant-out-of-range-compare]
&arg_index)) != -1) {
Tested: make -C tools/testing/selftests TARGETS="net" run_tests
Fixes: 16e781224198 ("selftests/net: Add a test to validate behavior of rx timestamps")
Signed-off-by: Tanner Love <tannerlove@google.com>
Acked-by: Willem de Bruijn <willemb@google.com>
---
tools/testing/selftests/net/rxtimestamp.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tools/testing/selftests/net/rxtimestamp.c b/tools/testing/selftests/net/rxtimestamp.c
index 422e7761254d..bcb79ba1f214 100644
--- a/tools/testing/selftests/net/rxtimestamp.c
+++ b/tools/testing/selftests/net/rxtimestamp.c
@@ -329,8 +329,7 @@ int main(int argc, char **argv)
bool all_tests = true;
int arg_index = 0;
int failures = 0;
- int s, t;
- char opt;
+ int s, t, opt;
while ((opt = getopt_long(argc, argv, "", long_options,
&arg_index)) != -1) {
--
2.28.0.rc0.142.g3c755180ce-goog
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net 2/4] selftests/net: psock_fanout: fix clang issues for target arch PowerPC
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 ` Tanner Love
2020-07-27 16:25 ` [PATCH net 3/4] selftests/net: so_txtime: " Tanner Love
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Tanner Love @ 2020-07-27 16:25 UTC (permalink / raw)
To: netdev; +Cc: davem, Tanner Love, Willem de Bruijn
From: Tanner Love <tannerlove@google.com>
Clang 9 threw:
warning: format specifies type 'unsigned short' but the argument has \
type 'int' [-Wformat]
typeflags, PORT_BASE, PORT_BASE + port_off);
Tested: make -C tools/testing/selftests TARGETS="net" run_tests
Fixes: 77f65ebdca50 ("packet: packet fanout rollover during socket overload")
Signed-off-by: Tanner Love <tannerlove@google.com>
Acked-by: Willem de Bruijn <willemb@google.com>
---
tools/testing/selftests/net/psock_fanout.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/psock_fanout.c b/tools/testing/selftests/net/psock_fanout.c
index 8c8c7d79c38d..2c522f7a0aec 100644
--- a/tools/testing/selftests/net/psock_fanout.c
+++ b/tools/testing/selftests/net/psock_fanout.c
@@ -350,7 +350,8 @@ static int test_datapath(uint16_t typeflags, int port_off,
int fds[2], fds_udp[2][2], ret;
fprintf(stderr, "\ntest: datapath 0x%hx ports %hu,%hu\n",
- typeflags, PORT_BASE, PORT_BASE + port_off);
+ typeflags, (uint16_t)PORT_BASE,
+ (uint16_t)(PORT_BASE + port_off));
fds[0] = sock_fanout_open(typeflags, 0);
fds[1] = sock_fanout_open(typeflags, 0);
--
2.28.0.rc0.142.g3c755180ce-goog
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net 3/4] selftests/net: so_txtime: fix clang issues for target arch PowerPC
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 ` Tanner Love
2020-07-27 16:25 ` [PATCH net 4/4] selftests/net: tcp_mmap: fix clang warning " Tanner Love
2020-07-27 19:57 ` [PATCH net 0/4] selftests/net: Fix clang warnings on powerpc David Miller
4 siblings, 0 replies; 7+ messages in thread
From: Tanner Love @ 2020-07-27 16:25 UTC (permalink / raw)
To: netdev; +Cc: davem, Tanner Love, Willem de Bruijn
From: Tanner Love <tannerlove@google.com>
On powerpcle, int64_t maps to long long. Clang 9 threw:
warning: absolute value function 'labs' given an argument of type \
'long long' but has parameter of type 'long' which may cause \
truncation of value [-Wabsolute-value]
if (labs(tstop - texpect) > cfg_variance_us)
Tested: make -C tools/testing/selftests TARGETS="net" run_tests
Fixes: af5136f95045 ("selftests/net: SO_TXTIME with ETF and FQ")
Signed-off-by: Tanner Love <tannerlove@google.com>
Acked-by: Willem de Bruijn <willemb@google.com>
---
tools/testing/selftests/net/so_txtime.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/so_txtime.c b/tools/testing/selftests/net/so_txtime.c
index ceaad78e9667..3155fbbf644b 100644
--- a/tools/testing/selftests/net/so_txtime.c
+++ b/tools/testing/selftests/net/so_txtime.c
@@ -121,7 +121,7 @@ static bool do_recv_one(int fdr, struct timed_send *ts)
if (rbuf[0] != ts->data)
error(1, 0, "payload mismatch. expected %c", ts->data);
- if (labs(tstop - texpect) > cfg_variance_us)
+ if (llabs(tstop - texpect) > cfg_variance_us)
error(1, 0, "exceeds variance (%d us)", cfg_variance_us);
return false;
--
2.28.0.rc0.142.g3c755180ce-goog
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net 4/4] selftests/net: tcp_mmap: fix clang warning for target arch PowerPC
2020-07-27 16:25 [PATCH net 0/4] selftests/net: Fix clang warnings on powerpc Tanner Love
` (2 preceding siblings ...)
2020-07-27 16:25 ` [PATCH net 3/4] selftests/net: so_txtime: " Tanner Love
@ 2020-07-27 16:25 ` Tanner Love
2020-07-27 19:33 ` Eric Dumazet
2020-07-27 19:57 ` [PATCH net 0/4] selftests/net: Fix clang warnings on powerpc David Miller
4 siblings, 1 reply; 7+ messages in thread
From: Tanner Love @ 2020-07-27 16:25 UTC (permalink / raw)
To: netdev; +Cc: davem, Tanner Love, Willem de Bruijn
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net 4/4] selftests/net: tcp_mmap: fix clang warning for target arch PowerPC
2020-07-27 16:25 ` [PATCH net 4/4] selftests/net: tcp_mmap: fix clang warning " Tanner Love
@ 2020-07-27 19:33 ` Eric Dumazet
0 siblings, 0 replies; 7+ messages in thread
From: Eric Dumazet @ 2020-07-27 19:33 UTC (permalink / raw)
To: Tanner Love, netdev; +Cc: davem, Tanner Love, Willem de Bruijn
On 7/27/20 9:25 AM, Tanner Love wrote:
> 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>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Thanks !
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net 0/4] selftests/net: Fix clang warnings on powerpc
2020-07-27 16:25 [PATCH net 0/4] selftests/net: Fix clang warnings on powerpc Tanner Love
` (3 preceding siblings ...)
2020-07-27 16:25 ` [PATCH net 4/4] selftests/net: tcp_mmap: fix clang warning " Tanner Love
@ 2020-07-27 19:57 ` David Miller
4 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2020-07-27 19:57 UTC (permalink / raw)
To: tannerlove.kernel; +Cc: netdev, tannerlove
From: Tanner Love <tannerlove.kernel@gmail.com>
Date: Mon, 27 Jul 2020 12:25:27 -0400
> This is essentially a v2 of
> http://patchwork.ozlabs.org/project/netdev/patch/20200724181757.2331172-1-tannerlove.kernel@gmail.com/,
> but it has been split up in order to have only one "Fixes" tag per
> patch.
Series applied, thank you.
^ permalink raw reply [flat|nested] 7+ messages in thread