tools/testing/selftests/net/mptcp/mptcp_connect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
From: Geliang Tang <tanggeliang@kylinos.cn>
In mptcp_connect.c, strchr() returns a pointer to a character within
the input string, which is declared as const char *. Assigning this
return value to a non-const char * discards the const qualifier,
triggering compiler warnings:
make: Entering directory 'tools/testing/selftests/net/mptcp'
CC mptcp_connect
mptcp_connect.c: In function 'parse_cmsg_types':
mptcp_connect.c:1267:22: warning: initialization discards 'const'
qualifier from pointer target type [-Wdiscarded-qualifiers]
1267 | char *next = strchr(type, ',');
| ^~~~~~
mptcp_connect.c: In function 'parse_setsock_options':
mptcp_connect.c:1295:22: warning: initialization discards 'const'
qualifier from pointer target type [-Wdiscarded-qualifiers]
1295 | char *next = strchr(name, ',');
| ^~~~~~
make: Leaving directory 'tools/testing/selftests/net/mptcp'
Fix these warnings by declaring the 'next' variable as const char *,
as it is only used for read-only parsing.
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
tools/testing/selftests/net/mptcp/mptcp_connect.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c
index cbe573c4ab3a..ea4cb6c1bd5e 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c
@@ -1264,7 +1264,7 @@ static void apply_cmsg_types(int fd, const struct cfg_cmsg_types *cmsg)
static void parse_cmsg_types(const char *type)
{
- char *next = strchr(type, ',');
+ const char *next = strchr(type, ',');
unsigned int len = 0;
cfg_cmsg_types.cmsg_enabled = 1;
@@ -1292,7 +1292,7 @@ static void parse_cmsg_types(const char *type)
static void parse_setsock_options(const char *name)
{
- char *next = strchr(name, ',');
+ const char *next = strchr(name, ',');
unsigned int len = 0;
if (next) {
--
2.53.0
Hi Geliang, On 20/06/2026 01:32, Geliang Tang wrote: > From: Geliang Tang <tanggeliang@kylinos.cn> > > In mptcp_connect.c, strchr() returns a pointer to a character within > the input string, which is declared as const char *. Assigning this > return value to a non-const char * discards the const qualifier, > triggering compiler warnings: > > make: Entering directory 'tools/testing/selftests/net/mptcp' > CC mptcp_connect > mptcp_connect.c: In function 'parse_cmsg_types': > mptcp_connect.c:1267:22: warning: initialization discards 'const' > qualifier from pointer target type [-Wdiscarded-qualifiers] > 1267 | char *next = strchr(type, ','); > | ^~~~~~ > mptcp_connect.c: In function 'parse_setsock_options': > mptcp_connect.c:1295:22: warning: initialization discards 'const' > qualifier from pointer target type [-Wdiscarded-qualifiers] > 1295 | char *next = strchr(name, ','); > | ^~~~~~ > make: Leaving directory 'tools/testing/selftests/net/mptcp' > > Fix these warnings by declaring the 'next' variable as const char *, > as it is only used for read-only parsing. Thanks! Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> New patches for t/upstream: - 7fb42c115a57: selftests: mptcp: fix const qualifier warnings in strchr usage - Results: 7fc976a6891c..23524644cc06 (export) Tests are now in progress: - export: https://github.com/multipath-tcp/mptcp_net-next/commit/83be48a0589e16868a5c7e58173046507a3084d1/checks Cheers, Matt -- Sponsored by the NGI0 Core fund.
Hi Geliang,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal (except selftest_mptcp_join): Success! ✅
- KVM Validation: normal (only selftest_mptcp_join): Success! ✅
- KVM Validation: debug (except selftest_mptcp_join): Notice: Call Traces at boot time, rebooted and continued ⚠️
- KVM Validation: debug (only selftest_mptcp_join): Notice: Call Traces at boot time, rebooted and continued ⚠️
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Notice: Call Traces at boot time, rebooted and continued ⚠️
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/27853696726
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/5b68cf5259c8
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1114094
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-normal
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 (NGI0 Core)
© 2016 - 2026 Red Hat, Inc.