* [PATCH mptcp-next] selftests: mptcp: Initialize variables to quiet gcc 12 warnings
@ 2022-06-22 0:18 Mat Martineau
2022-06-22 1:46 ` selftests: mptcp: Initialize variables to quiet gcc 12 warnings: Tests Results MPTCP CI
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Mat Martineau @ 2022-06-22 0:18 UTC (permalink / raw)
To: mptcp; +Cc: Mat Martineau
In a few MPTCP selftest tools, gcc 12 complains that the 'sock' variable
might be used uninitialized. This is a false positive because the only
code path that could lead to uninitialized access is where getaddrinfo()
fails, but the local xgetaddrinfo() wrapper exits if such a failure
occurs.
Initialize the 'sock' variable anyway to allow the tools to build with
gcc 12.
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
---
tools/testing/selftests/net/mptcp/mptcp_connect.c | 2 +-
tools/testing/selftests/net/mptcp/mptcp_inq.c | 2 +-
tools/testing/selftests/net/mptcp/mptcp_sockopt.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c
index 8628aa61b763..e2ea6c126c99 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c
@@ -265,7 +265,7 @@ static void sock_test_tcpulp(int sock, int proto, unsigned int line)
static int sock_listen_mptcp(const char * const listenaddr,
const char * const port)
{
- int sock;
+ int sock = -1;
struct addrinfo hints = {
.ai_protocol = IPPROTO_TCP,
.ai_socktype = SOCK_STREAM,
diff --git a/tools/testing/selftests/net/mptcp/mptcp_inq.c b/tools/testing/selftests/net/mptcp/mptcp_inq.c
index 29f75e2a1116..8672d898f8cd 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_inq.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_inq.c
@@ -88,7 +88,7 @@ static void xgetaddrinfo(const char *node, const char *service,
static int sock_listen_mptcp(const char * const listenaddr,
const char * const port)
{
- int sock;
+ int sock = -1;
struct addrinfo hints = {
.ai_protocol = IPPROTO_TCP,
.ai_socktype = SOCK_STREAM,
diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
index ac9a4d9c1764..ae61f39556ca 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
@@ -136,7 +136,7 @@ static void xgetaddrinfo(const char *node, const char *service,
static int sock_listen_mptcp(const char * const listenaddr,
const char * const port)
{
- int sock;
+ int sock = -1;
struct addrinfo hints = {
.ai_protocol = IPPROTO_TCP,
.ai_socktype = SOCK_STREAM,
--
2.36.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: selftests: mptcp: Initialize variables to quiet gcc 12 warnings: Tests Results
2022-06-22 0:18 [PATCH mptcp-next] selftests: mptcp: Initialize variables to quiet gcc 12 warnings Mat Martineau
@ 2022-06-22 1:46 ` MPTCP CI
2022-06-22 9:53 ` [PATCH mptcp-next] selftests: mptcp: Initialize variables to quiet gcc 12 warnings Paolo Abeni
2022-06-22 21:13 ` Matthieu Baerts
2 siblings, 0 replies; 4+ messages in thread
From: MPTCP CI @ 2022-06-22 1:46 UTC (permalink / raw)
To: Mat Martineau; +Cc: mptcp
Hi Mat,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal:
- Success! ✅:
- Task: https://cirrus-ci.com/task/6252603284652032
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6252603284652032/summary/summary.txt
- KVM Validation: debug:
- Unstable: 2 failed test(s): selftest_diag selftest_mptcp_join 🔴:
- Task: https://cirrus-ci.com/task/4845228401098752
- Summary: https://api.cirrus-ci.com/v1/artifact/task/4845228401098752/summary/summary.txt
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/623b51ae3220
If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:
$ cd [kernel source code]
$ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
--pull always mptcp/mptcp-upstream-virtme-docker:latest \
auto-debug
For more details:
https://github.com/multipath-tcp/mptcp-upstream-virtme-docker
Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (Tessares)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH mptcp-next] selftests: mptcp: Initialize variables to quiet gcc 12 warnings
2022-06-22 0:18 [PATCH mptcp-next] selftests: mptcp: Initialize variables to quiet gcc 12 warnings Mat Martineau
2022-06-22 1:46 ` selftests: mptcp: Initialize variables to quiet gcc 12 warnings: Tests Results MPTCP CI
@ 2022-06-22 9:53 ` Paolo Abeni
2022-06-22 21:13 ` Matthieu Baerts
2 siblings, 0 replies; 4+ messages in thread
From: Paolo Abeni @ 2022-06-22 9:53 UTC (permalink / raw)
To: Mat Martineau, mptcp
On Tue, 2022-06-21 at 17:18 -0700, Mat Martineau wrote:
> In a few MPTCP selftest tools, gcc 12 complains that the 'sock' variable
> might be used uninitialized. This is a false positive because the only
> code path that could lead to uninitialized access is where getaddrinfo()
> fails, but the local xgetaddrinfo() wrapper exits if such a failure
> occurs.
>
> Initialize the 'sock' variable anyway to allow the tools to build with
> gcc 12.
>
> Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
> ---
> tools/testing/selftests/net/mptcp/mptcp_connect.c | 2 +-
> tools/testing/selftests/net/mptcp/mptcp_inq.c | 2 +-
> tools/testing/selftests/net/mptcp/mptcp_sockopt.c | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c
> index 8628aa61b763..e2ea6c126c99 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
> +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c
> @@ -265,7 +265,7 @@ static void sock_test_tcpulp(int sock, int proto, unsigned int line)
> static int sock_listen_mptcp(const char * const listenaddr,
> const char * const port)
> {
> - int sock;
> + int sock = -1;
> struct addrinfo hints = {
> .ai_protocol = IPPROTO_TCP,
> .ai_socktype = SOCK_STREAM,
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_inq.c b/tools/testing/selftests/net/mptcp/mptcp_inq.c
> index 29f75e2a1116..8672d898f8cd 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_inq.c
> +++ b/tools/testing/selftests/net/mptcp/mptcp_inq.c
> @@ -88,7 +88,7 @@ static void xgetaddrinfo(const char *node, const char *service,
> static int sock_listen_mptcp(const char * const listenaddr,
> const char * const port)
> {
> - int sock;
> + int sock = -1;
> struct addrinfo hints = {
> .ai_protocol = IPPROTO_TCP,
> .ai_socktype = SOCK_STREAM,
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
> index ac9a4d9c1764..ae61f39556ca 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
> +++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
> @@ -136,7 +136,7 @@ static void xgetaddrinfo(const char *node, const char *service,
> static int sock_listen_mptcp(const char * const listenaddr,
> const char * const port)
> {
> - int sock;
> + int sock = -1;
> struct addrinfo hints = {
> .ai_protocol = IPPROTO_TCP,
> .ai_socktype = SOCK_STREAM,
LGTM, thanks!
Acked-by: Paolo Abeni <pabeni@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH mptcp-next] selftests: mptcp: Initialize variables to quiet gcc 12 warnings
2022-06-22 0:18 [PATCH mptcp-next] selftests: mptcp: Initialize variables to quiet gcc 12 warnings Mat Martineau
2022-06-22 1:46 ` selftests: mptcp: Initialize variables to quiet gcc 12 warnings: Tests Results MPTCP CI
2022-06-22 9:53 ` [PATCH mptcp-next] selftests: mptcp: Initialize variables to quiet gcc 12 warnings Paolo Abeni
@ 2022-06-22 21:13 ` Matthieu Baerts
2 siblings, 0 replies; 4+ messages in thread
From: Matthieu Baerts @ 2022-06-22 21:13 UTC (permalink / raw)
To: Mat Martineau, mptcp
Hi Mat, Paolo,
On 22/06/2022 02:18, Mat Martineau wrote:
> In a few MPTCP selftest tools, gcc 12 complains that the 'sock' variable
> might be used uninitialized. This is a false positive because the only
> code path that could lead to uninitialized access is where getaddrinfo()
> fails, but the local xgetaddrinfo() wrapper exits if such a failure
> occurs.
>
> Initialize the 'sock' variable anyway to allow the tools to build with
> gcc 12.
Thank you for the patch and the review!
I just applied this patch in our tree (feat. for net-next but maybe it
could go in 'fix for -net' with a 'Fixes' tag, no?) with Paolo's ACK:
New patches for t/upstream:
- 5a3689ec11a3: selftests: mptcp: Initialize variables to quiet gcc 12
warnings
- Results: 8346c4604d29..cbb1cc653035 (export)
Builds and tests are now in progress:
https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20220622T211129
https://github.com/multipath-tcp/mptcp_net-next/actions/workflows/build-validation.yml?query=branch:export
Cheers,
Matt
--
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-06-22 21:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-22 0:18 [PATCH mptcp-next] selftests: mptcp: Initialize variables to quiet gcc 12 warnings Mat Martineau
2022-06-22 1:46 ` selftests: mptcp: Initialize variables to quiet gcc 12 warnings: Tests Results MPTCP CI
2022-06-22 9:53 ` [PATCH mptcp-next] selftests: mptcp: Initialize variables to quiet gcc 12 warnings Paolo Abeni
2022-06-22 21:13 ` Matthieu Baerts
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).