[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <86o6pouuua.wl-maz@kernel.org>
Date: Thu, 30 Oct 2025 18:07:25 +0000
From: Marc Zyngier <maz@...nel.org>
To: Markus Elfring <Markus.Elfring@....de>
Cc: kvmarm@...ts.linux.dev,
	linux-arm-kernel@...ts.infradead.org,
	Andrew Walbran <qwandor@...gle.com>,
	Ayrton Munoz <ayrton@...gle.com>,
	Catalin Marinas <catalin.marinas@....com>,
	Joey Gouly <joey.gouly@....com>,
	Oliver Upton <oliver.upton@...ux.dev>,
	Per Larsen <perlarsen@...gle.com>,
	Quentin Perret <qperret@...gle.com>,
	Suzuki Poulouse <suzuki.poulose@....com>,
	Will Deacon <will@...nel.org>,
	Zenghui Yu <yuzenghui@...wei.com>,
	LKML <linux-kernel@...r.kernel.org>,
	kernel-janitors@...r.kernel.org,
	Miaoqian Lin <linmq006@...il.com>
Subject: Re: [PATCH] KVM: arm64: FFA: Use pointers from memcpy() calls for assignments in three functions
On Thu, 30 Oct 2025 17:40:39 +0000,
Markus Elfring <Markus.Elfring@....de> wrote:
> 
> From: Markus Elfring <elfring@...rs.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@...rs.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.
Powered by blists - more mailing lists
 
