net/mptcp/pm_netlink.c | 4 ++-- net/mptcp/sockopt.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
When 'err' is 0, it looks clearer to return '0' instead of the variable
called 'err'.
The behaviour is then not modified, just a clearer code.
By doing this, we can also avoid false positive smatch warnings like
this one:
net/mptcp/pm_netlink.c:1169 mptcp_pm_parse_pm_addr_attr() warn: missing error code? 'err'
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Suggested-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---
net/mptcp/pm_netlink.c | 4 ++--
net/mptcp/sockopt.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index 39b0f054f39f..d20f1d969900 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -1187,7 +1187,7 @@ static int mptcp_pm_parse_pm_addr_attr(struct nlattr *tb[],
if (!tb[MPTCP_PM_ADDR_ATTR_FAMILY]) {
if (!require_family)
- return err;
+ return 0;
NL_SET_ERR_MSG_ATTR(info->extack, attr,
"missing family");
@@ -1221,7 +1221,7 @@ static int mptcp_pm_parse_pm_addr_attr(struct nlattr *tb[],
if (tb[MPTCP_PM_ADDR_ATTR_PORT])
addr->port = htons(nla_get_u16(tb[MPTCP_PM_ADDR_ATTR_PORT]));
- return err;
+ return 0;
}
int mptcp_pm_parse_addr(struct nlattr *attr, struct genl_info *info,
diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c
index a47423ebb33a..d4b1e6ec1b36 100644
--- a/net/mptcp/sockopt.c
+++ b/net/mptcp/sockopt.c
@@ -740,7 +740,7 @@ static int mptcp_setsockopt_v4_set_tos(struct mptcp_sock *msk, int optname,
}
release_sock(sk);
- return err;
+ return 0;
}
static int mptcp_setsockopt_v4(struct mptcp_sock *msk, int optname,
base-commit: 9324c815f96dd77d23679e999edb875d9f4acd34
--
2.37.2
Hi Matthieu,
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! ✅:
- Task: https://cirrus-ci.com/task/6314116181131264
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6314116181131264/summary/summary.txt
- KVM Validation: debug (only selftest_mptcp_join):
- Unstable: 1 failed test(s): selftest_mptcp_join 🔴:
- Task: https://cirrus-ci.com/task/5469691250999296
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5469691250999296/summary/summary.txt
- KVM Validation: debug (except selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/6032641204420608
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6032641204420608/summary/summary.txt
- KVM Validation: normal (only selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/4906741297577984
- Summary: https://api.cirrus-ci.com/v1/artifact/task/4906741297577984/summary/summary.txt
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/03d981012d68
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)
On Mon, 5 Dec 2022, Matthieu Baerts wrote:
> When 'err' is 0, it looks clearer to return '0' instead of the variable
> called 'err'.
>
> The behaviour is then not modified, just a clearer code.
>
> By doing this, we can also avoid false positive smatch warnings like
> this one:
>
> net/mptcp/pm_netlink.c:1169 mptcp_pm_parse_pm_addr_attr() warn: missing error code? 'err'
>
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <error27@gmail.com>
> Suggested-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Thanks for the cleanup Matthieu. Looks good to me.
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
> ---
> net/mptcp/pm_netlink.c | 4 ++--
> net/mptcp/sockopt.c | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
> index 39b0f054f39f..d20f1d969900 100644
> --- a/net/mptcp/pm_netlink.c
> +++ b/net/mptcp/pm_netlink.c
> @@ -1187,7 +1187,7 @@ static int mptcp_pm_parse_pm_addr_attr(struct nlattr *tb[],
>
> if (!tb[MPTCP_PM_ADDR_ATTR_FAMILY]) {
> if (!require_family)
> - return err;
> + return 0;
>
> NL_SET_ERR_MSG_ATTR(info->extack, attr,
> "missing family");
> @@ -1221,7 +1221,7 @@ static int mptcp_pm_parse_pm_addr_attr(struct nlattr *tb[],
> if (tb[MPTCP_PM_ADDR_ATTR_PORT])
> addr->port = htons(nla_get_u16(tb[MPTCP_PM_ADDR_ATTR_PORT]));
>
> - return err;
> + return 0;
> }
>
> int mptcp_pm_parse_addr(struct nlattr *attr, struct genl_info *info,
> diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c
> index a47423ebb33a..d4b1e6ec1b36 100644
> --- a/net/mptcp/sockopt.c
> +++ b/net/mptcp/sockopt.c
> @@ -740,7 +740,7 @@ static int mptcp_setsockopt_v4_set_tos(struct mptcp_sock *msk, int optname,
> }
> release_sock(sk);
>
> - return err;
> + return 0;
> }
>
> static int mptcp_setsockopt_v4(struct mptcp_sock *msk, int optname,
>
> base-commit: 9324c815f96dd77d23679e999edb875d9f4acd34
> --
> 2.37.2
>
>
--
Mat Martineau
Intel
Hi Mat, On 05/12/2022 22:31, Mat Martineau wrote: > On Mon, 5 Dec 2022, Matthieu Baerts wrote: > >> When 'err' is 0, it looks clearer to return '0' instead of the variable >> called 'err'. >> >> The behaviour is then not modified, just a clearer code. >> >> By doing this, we can also avoid false positive smatch warnings like >> this one: >> >> net/mptcp/pm_netlink.c:1169 mptcp_pm_parse_pm_addr_attr() warn: >> missing error code? 'err' >> >> Reported-by: kernel test robot <lkp@intel.com> >> Reported-by: Dan Carpenter <error27@gmail.com> >> Suggested-by: Mat Martineau <mathew.j.martineau@linux.intel.com> >> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net> > > Thanks for the cleanup Matthieu. Looks good to me. > > Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Thank you for the review! Now in our tree (feat. for net-next) with your RvB tag: New patches for t/upstream: - 1172127291d8: mptcp: return 0 instead of 'err' var - Results: c7fdd02a4241..fb04e49223d2 (export) Tests are now in progress: https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20221206T110210 Cheers, Matt -- Tessares | Belgium | Hybrid Access Solutions www.tessares.net
Hi Matthieu,
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! ✅:
- Task: https://cirrus-ci.com/task/6075817906667520
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6075817906667520/summary/summary.txt
- KVM Validation: normal (only selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/5512867953246208
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5512867953246208/summary/summary.txt
- KVM Validation: debug (only selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/4598074278936576
- Summary: https://api.cirrus-ci.com/v1/artifact/task/4598074278936576/summary/summary.txt
- KVM Validation: debug (except selftest_mptcp_join):
- Critical: 1 Call Trace(s) ❌:
- Task: https://cirrus-ci.com/task/6638767860088832
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6638767860088832/summary/summary.txt
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/9fbf63562082
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)
© 2016 - 2026 Red Hat, Inc.