diff mbox series

selftests: net: tls: remove unused variable and code

Message ID 20211105164511.3360473-1-anders.roxell@linaro.org (mailing list archive)
State Accepted
Commit 62b12ab5dff038ea43b69207b1f42ddc2f0a0b09
Delegated to: Netdev Maintainers
Headers show
Series selftests: net: tls: remove unused variable and code | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 15 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Anders Roxell Nov. 5, 2021, 4:45 p.m. UTC
When building selftests/net with clang, the compiler warn about the
function abs() see below:

tls.c:657:15: warning: variable 'len_compared' set but not used [-Wunused-but-set-variable]
        unsigned int len_compared = 0;
                     ^

Rework to remove the unused variable and the for-loop where the variable
'len_compared' was assinged.

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
 tools/testing/selftests/net/tls.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Nick Desaulniers Nov. 5, 2021, 8:47 p.m. UTC | #1
On Fri, Nov 5, 2021 at 9:45 AM Anders Roxell <anders.roxell@linaro.org> wrote:
>
> When building selftests/net with clang, the compiler warn about the
> function abs() see below:
>
> tls.c:657:15: warning: variable 'len_compared' set but not used [-Wunused-but-set-variable]
>         unsigned int len_compared = 0;
>                      ^
>
> Rework to remove the unused variable and the for-loop where the variable
> 'len_compared' was assinged.
>
> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>

Thanks for the patch. Hard to say what the original intent was here.

Fixes: 7f657d5bf507 ("selftests: tls: add selftests for TLS sockets")
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> ---
>  tools/testing/selftests/net/tls.c | 3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/tools/testing/selftests/net/tls.c b/tools/testing/selftests/net/tls.c
> index d3047e251fe9..e61fc4c32ba2 100644
> --- a/tools/testing/selftests/net/tls.c
> +++ b/tools/testing/selftests/net/tls.c
> @@ -654,7 +654,6 @@ TEST_F(tls, recvmsg_single_max)
>  TEST_F(tls, recvmsg_multiple)
>  {
>         unsigned int msg_iovlen = 1024;
> -       unsigned int len_compared = 0;
>         struct iovec vec[1024];
>         char *iov_base[1024];
>         unsigned int iov_len = 16;
> @@ -675,8 +674,6 @@ TEST_F(tls, recvmsg_multiple)
>         hdr.msg_iovlen = msg_iovlen;
>         hdr.msg_iov = vec;
>         EXPECT_NE(recvmsg(self->cfd, &hdr, 0), -1);
> -       for (i = 0; i < msg_iovlen; i++)
> -               len_compared += iov_len;
>
>         for (i = 0; i < msg_iovlen; i++)
>                 free(iov_base[i]);
> --
> 2.33.0
>
patchwork-bot+netdevbpf@kernel.org Nov. 7, 2021, 7:40 p.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Fri,  5 Nov 2021 17:45:11 +0100 you wrote:
> When building selftests/net with clang, the compiler warn about the
> function abs() see below:
> 
> tls.c:657:15: warning: variable 'len_compared' set but not used [-Wunused-but-set-variable]
>         unsigned int len_compared = 0;
>                      ^
> 
> [...]

Here is the summary with links:
  - selftests: net: tls: remove unused variable and code
    https://git.kernel.org/netdev/net/c/62b12ab5dff0

You are awesome, thank you!
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/tls.c b/tools/testing/selftests/net/tls.c
index d3047e251fe9..e61fc4c32ba2 100644
--- a/tools/testing/selftests/net/tls.c
+++ b/tools/testing/selftests/net/tls.c
@@ -654,7 +654,6 @@  TEST_F(tls, recvmsg_single_max)
 TEST_F(tls, recvmsg_multiple)
 {
 	unsigned int msg_iovlen = 1024;
-	unsigned int len_compared = 0;
 	struct iovec vec[1024];
 	char *iov_base[1024];
 	unsigned int iov_len = 16;
@@ -675,8 +674,6 @@  TEST_F(tls, recvmsg_multiple)
 	hdr.msg_iovlen = msg_iovlen;
 	hdr.msg_iov = vec;
 	EXPECT_NE(recvmsg(self->cfd, &hdr, 0), -1);
-	for (i = 0; i < msg_iovlen; i++)
-		len_compared += iov_len;
 
 	for (i = 0; i < msg_iovlen; i++)
 		free(iov_base[i]);