From: Matthieu Baerts <matttbe@kernel.org>
To: Geliang Tang <geliang@kernel.org>, mptcp@lists.linux.dev
Cc: Geliang Tang <tanggeliang@kylinos.cn>
Subject: Re: [PATCH mptcp-next] Squash to "selftests: mptcp: add splice io mode"
Date: Fri, 30 Jan 2026 11:50:51 +0100 [thread overview]
Message-ID: <732e23f4-979e-4bc4-bae4-1cbf01aa21ec@kernel.org> (raw)
In-Reply-To: <c24b6414ed2ec128f8ed00be9aa84e0a33c484e8.1769769757.git.tanggeliang@kylinos.cn>
Hi Geliang,
On 30/01/2026 11:43, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> Check the return value of splice().
Thank you for looking at that.
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
> tools/testing/selftests/net/mptcp/mptcp_connect.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c
> index ff1a298d3469..aaa2248ac76e 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
> +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c
> @@ -947,14 +947,16 @@ static int do_splice(const int infd, const int outfd, const size_t len,
> while ((bytes = splice(infd, NULL, pipefd[1], NULL,
> len - winfo->total_len,
> SPLICE_F_MOVE | SPLICE_F_MORE)) > 0) {
> - splice(pipefd[0], NULL, outfd, NULL, bytes,
> - SPLICE_F_MOVE | SPLICE_F_MORE);
> + bytes = splice(pipefd[0], NULL, outfd, NULL, bytes,
> + SPLICE_F_MOVE | SPLICE_F_MORE);
> + if (bytes <= 0)
> + break;
Please check [1]: that's not enough: it is important to print the error
to be able to find out what went wrong in case of error. Also, the two
splice() should return the same value, and if "bytes" is 0 here, that's
not normal.
[1]
https://lore.kernel.org/mptcp/20260130-mptcp-sft-no-ignore-splice-err-v1-1-af0a458b6ec8@kernel.org
> }
>
> close(pipefd[0]);
> close(pipefd[1]);
>
> - return 0;
> + return bytes < 0 ? bytes : 0;
The returned value is supposed to be positive (that's the exit returned
value). Also, I don't think you are supposed to have bytes > 0 here, no?
> }
>
> static int copyfd_io_splice(int infd, int peerfd, int outfd, unsigned int size,
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2026-01-30 10:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-30 10:43 [PATCH mptcp-next] Squash to "selftests: mptcp: add splice io mode" Geliang Tang
2026-01-30 10:50 ` Matthieu Baerts [this message]
2026-01-30 13:56 ` Geliang Tang
2026-01-30 11:45 ` MPTCP CI
-- strict thread matches above, loose matches on Subject: below --
2026-01-30 10:17 Matthieu Baerts (NGI0)
2026-01-30 11:15 ` MPTCP CI
2026-01-30 13:46 ` Geliang Tang
2026-01-30 18:45 ` Matthieu Baerts
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=732e23f4-979e-4bc4-bae4-1cbf01aa21ec@kernel.org \
--to=matttbe@kernel.org \
--cc=geliang@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=tanggeliang@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox