[v9,02/15] app/test: remove unused variable

Message ID 20250220164151.9606-3-stephen@networkplumber.org (mailing list archive)
State Accepted
Delegated to: Thomas Monjalon
Headers
Series fix insecure use of memset bugs |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Feb. 20, 2025, 4:27 p.m. UTC
The buffer tmp is set but never used. This leads to warning
since the memset could be eliminated by the compiler.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/test/test_cmdline_cirbuf.c | 2 --
 1 file changed, 2 deletions(-)
  

Comments

Thomas Monjalon June 11, 2025, 12:33 p.m. UTC | #1
20/02/2025 17:27, Stephen Hemminger:
> The buffer tmp is set but never used. This leads to warning
> since the memset could be eliminated by the compiler.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  app/test/test_cmdline_cirbuf.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/app/test/test_cmdline_cirbuf.c b/app/test/test_cmdline_cirbuf.c
> index 8ac326cb02..f6361d49e9 100644
> --- a/app/test/test_cmdline_cirbuf.c
> +++ b/app/test/test_cmdline_cirbuf.c
> @@ -251,11 +251,9 @@ test_cirbuf_string_add_del_reverse(void)
>  {
>  	struct cirbuf cb;
>  	char buf[CMDLINE_TEST_BUFSIZE];
> -	char tmp[CMDLINE_TEST_BUFSIZE];
>  
>  	/* initialize buffers */
>  	memset(buf, 0, sizeof(buf));
> -	memset(tmp, 0, sizeof(tmp));

Another memset was missed in this function.
Fixed while merging.
  

Patch

diff --git a/app/test/test_cmdline_cirbuf.c b/app/test/test_cmdline_cirbuf.c
index 8ac326cb02..f6361d49e9 100644
--- a/app/test/test_cmdline_cirbuf.c
+++ b/app/test/test_cmdline_cirbuf.c
@@ -251,11 +251,9 @@  test_cirbuf_string_add_del_reverse(void)
 {
 	struct cirbuf cb;
 	char buf[CMDLINE_TEST_BUFSIZE];
-	char tmp[CMDLINE_TEST_BUFSIZE];
 
 	/* initialize buffers */
 	memset(buf, 0, sizeof(buf));
-	memset(tmp, 0, sizeof(tmp));
 
 	/*
 	 * initialize circular buffer