diff mbox series

[v1,net-next] selftest/net: Fix uninit val warning in tcp_mmap.c.

Message ID 20230405023236.10128-1-kuniyu@amazon.com (mailing list archive)
State Not Applicable
Delegated to: Netdev Maintainers
Headers show
Series [v1,net-next] selftest/net: Fix uninit val warning in tcp_mmap.c. | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 18 this patch: 18
netdev/cc_maintainers warning 2 maintainers not CCed: shuah@kernel.org linux-kselftest@vger.kernel.org
netdev/build_clang success Errors and warnings before: 18 this patch: 18
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 18 this patch: 18
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Kuniyuki Iwashima April 5, 2023, 2:32 a.m. UTC
Commit 5c5945dc695c ("selftests/net: Add SHA256 computation over data
sent in tcp_mmap") forgot to initialise a local var.

  $ make -s -C tools/testing/selftests/net
  tcp_mmap.c: In function ‘child_thread’:
  tcp_mmap.c:211:61: warning: ‘lu’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    211 |                         zc.length = min(chunk_size, FILE_SZ - lu);
        |                                                             ^

Fixes: 5c5945dc695c ("selftests/net: Add SHA256 computation over data sent in tcp_mmap")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
---
Note that the cited commit is not merged in net.git.
---
 tools/testing/selftests/net/tcp_mmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eric Dumazet April 5, 2023, 7:05 a.m. UTC | #1
On Wed, Apr 5, 2023 at 4:33 AM Kuniyuki Iwashima <kuniyu@amazon.com> wrote:
>
> Commit 5c5945dc695c ("selftests/net: Add SHA256 computation over data
> sent in tcp_mmap") forgot to initialise a local var.
>
>   $ make -s -C tools/testing/selftests/net
>   tcp_mmap.c: In function ‘child_thread’:
>   tcp_mmap.c:211:61: warning: ‘lu’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>     211 |                         zc.length = min(chunk_size, FILE_SZ - lu);
>         |                                                             ^
>
> Fixes: 5c5945dc695c ("selftests/net: Add SHA256 computation over data sent in tcp_mmap")
> Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
> ---
> Note that the cited commit is not merged in net.git.
> ---
>  tools/testing/selftests/net/tcp_mmap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/net/tcp_mmap.c b/tools/testing/selftests/net/tcp_mmap.c
> index 607cc9ad8d1b..1056e37f4d98 100644
> --- a/tools/testing/selftests/net/tcp_mmap.c
> +++ b/tools/testing/selftests/net/tcp_mmap.c
> @@ -168,7 +168,7 @@ void *child_thread(void *arg)
>         double throughput;
>         struct rusage ru;
>         size_t buffer_sz;
> -       int lu, fd;
> +       int lu = 0, fd;
>
>         fd = (int)(unsigned long)arg;
>
> --
> 2.30.2
>

This is not the right fix. I sent it yesterday, not sure if you have seen it ?
Kuniyuki Iwashima April 5, 2023, 3:25 p.m. UTC | #2
From:   Eric Dumazet <edumazet@google.com>
Date:   Wed, 5 Apr 2023 09:05:38 +0200
> On Wed, Apr 5, 2023 at 4:33 AM Kuniyuki Iwashima <kuniyu@amazon.com> wrote:
> >
> > Commit 5c5945dc695c ("selftests/net: Add SHA256 computation over data
> > sent in tcp_mmap") forgot to initialise a local var.
> >
> >   $ make -s -C tools/testing/selftests/net
> >   tcp_mmap.c: In function ‘child_thread’:
> >   tcp_mmap.c:211:61: warning: ‘lu’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> >     211 |                         zc.length = min(chunk_size, FILE_SZ - lu);
> >         |                                                             ^
> >
> > Fixes: 5c5945dc695c ("selftests/net: Add SHA256 computation over data sent in tcp_mmap")
> > Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
> > ---
> > Note that the cited commit is not merged in net.git.
> > ---
> >  tools/testing/selftests/net/tcp_mmap.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/testing/selftests/net/tcp_mmap.c b/tools/testing/selftests/net/tcp_mmap.c
> > index 607cc9ad8d1b..1056e37f4d98 100644
> > --- a/tools/testing/selftests/net/tcp_mmap.c
> > +++ b/tools/testing/selftests/net/tcp_mmap.c
> > @@ -168,7 +168,7 @@ void *child_thread(void *arg)
> >         double throughput;
> >         struct rusage ru;
> >         size_t buffer_sz;
> > -       int lu, fd;
> > +       int lu = 0, fd;
> >
> >         fd = (int)(unsigned long)arg;
> >
> > --
> > 2.30.2
> >
> 
> This is not the right fix. I sent it yesterday, not sure if you have seen it ?

Yes, I missed that.
Sorry for noise and thank you for your fix!
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/tcp_mmap.c b/tools/testing/selftests/net/tcp_mmap.c
index 607cc9ad8d1b..1056e37f4d98 100644
--- a/tools/testing/selftests/net/tcp_mmap.c
+++ b/tools/testing/selftests/net/tcp_mmap.c
@@ -168,7 +168,7 @@  void *child_thread(void *arg)
 	double throughput;
 	struct rusage ru;
 	size_t buffer_sz;
-	int lu, fd;
+	int lu = 0, fd;
 
 	fd = (int)(unsigned long)arg;