From: Marc Zyngier <maz@kernel.org>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
Andrew Walbran <qwandor@google.com>,
Ayrton Munoz <ayrton@google.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Joey Gouly <joey.gouly@arm.com>,
Oliver Upton <oliver.upton@linux.dev>,
Per Larsen <perlarsen@google.com>,
Quentin Perret <qperret@google.com>,
Suzuki Poulouse <suzuki.poulose@arm.com>,
Will Deacon <will@kernel.org>, Zenghui Yu <yuzenghui@huawei.com>,
LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org,
Miaoqian Lin <linmq006@gmail.com>
Subject: Re: [PATCH] KVM: arm64: FFA: Use pointers from memcpy() calls for assignments in three functions
Date: Thu, 30 Oct 2025 18:07:25 +0000 [thread overview]
Message-ID: <86o6pouuua.wl-maz@kernel.org> (raw)
In-Reply-To: <cb3bd42f-4fec-4300-8875-b6861716f274@web.de>
On Thu, 30 Oct 2025 17:40:39 +0000,
Markus Elfring <Markus.Elfring@web.de> wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 30 Oct 2025 18:25:55 +0100
>
> A pointer was assigned to a variable in three function implementations.
> The same pointer was used for the destination parameter of a memcpy() call.
> This function is documented in the way that the same value is returned.
> Thus convert separate statements into direct variable assignments for
> the return values from memory copy actions.
>
> The source code was transformed by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> arch/arm64/kvm/hyp/nvhe/ffa.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c
> index 4e16f9b96f63..4820a9e96f80 100644
> --- a/arch/arm64/kvm/hyp/nvhe/ffa.c
> +++ b/arch/arm64/kvm/hyp/nvhe/ffa.c
> @@ -431,8 +431,7 @@ static void do_ffa_mem_frag_tx(struct arm_smccc_1_2_regs *res,
> if (!host_buffers.tx)
> goto out_unlock;
>
> - buf = hyp_buffers.tx;
> - memcpy(buf, host_buffers.tx, fraglen);
> + buf = memcpy(hyp_buffers.tx, host_buffers.tx, fraglen);
> nr_ranges = fraglen / sizeof(*buf);
This is unreadable. And even if memcpy() behaves has you describe, you
are breaking a pattern that people are relying on.
I'm not planning to take anything of the sort.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
prev parent reply other threads:[~2025-10-30 18:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-30 17:40 [PATCH] KVM: arm64: FFA: Use pointers from memcpy() calls for assignments in three functions Markus Elfring
2025-10-30 18:07 ` Marc Zyngier [this message]
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=86o6pouuua.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=Markus.Elfring@web.de \
--cc=ayrton@google.com \
--cc=catalin.marinas@arm.com \
--cc=joey.gouly@arm.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linmq006@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oliver.upton@linux.dev \
--cc=perlarsen@google.com \
--cc=qperret@google.com \
--cc=qwandor@google.com \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
--cc=yuzenghui@huawei.com \
/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;
as well as URLs for NNTP newsgroup(s).