From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9CD4DCCF9F8 for ; Thu, 30 Oct 2025 18:07:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HjwyUHZEz0KwYyw/LIajQzx18ZrF7k/pmQol9CbaQ5w=; b=G6VCUXyTgr+b+L2WCd/zsx8S72 57+Lp8cBFddotqRd/jBLpnIcODYWiv2KRcUGc5NqU6TzXZlIPm70YKdLOYRu3WFDQfM3LAOjMRTYP +qcwE1VyMfU2Xk/nB7KdD+k6GYdJ4c/ErsJ86NNGWccrHTesPqv54Iq4e8EK5WtyHh/xRU4PkbE3k Q+XwCTi5CPaAHchMDjNhSM2yNR34OfWLSIZWFRyI+2aukCzN2Zd0nFFFwtguyJnalC0ib3EZRRBYh dxrJ9bQtKLrPhGhlGBlugbzyNc6E6bLBuTnrIjt7MXQvH0/C9yQG9hybCzmRcZONqzVMS8ehYEPCt f2gva6OA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vEX3b-00000004ZqC-3dCM; Thu, 30 Oct 2025 18:07:31 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vEX3Z-00000004Zpl-1rkF for linux-arm-kernel@lists.infradead.org; Thu, 30 Oct 2025 18:07:30 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id CC51240B5F; Thu, 30 Oct 2025 18:07:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 962C0C19423; Thu, 30 Oct 2025 18:07:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1761847648; bh=sRQqD17ahn+kzZRYxFkDmApRJ9iKc38vVieFyY53S8Y=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=CpCNCqbA4a4j8mKlyZlwnNktYacA2ZxPIrdQ2Q/UZ/+gorskwm1G8Jx0KYF46y3pK Rrp/vwuXr2oI/aGvKyK8JicqSrMnvy9NOuEUnDvNPQuW6VEoh5QCT9FUdSYY4VrpkA 3tO5zrlyJ/90umHZ0iyyjZ+CmaR64giYcJePFLAD9+g0FLXCu+dIhI0u7Kv+drIB29 nwLDUcWCsDb2RNZO5oRiy4En8Unpx23XjNmHIzs3YkbRMfo+8JhOnz/3v3mAYycpTe 2+DeBR7V1j2HpAVet/vPrMPhZCy/NdwCsDq0E+QtMU+ZL4Zmld+EZ3DMCo26H8/KnG Fp6Ghcb9+dkzA== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vEX3W-000000015F6-0bSG; Thu, 30 Oct 2025 18:07:26 +0000 Date: Thu, 30 Oct 2025 18:07:25 +0000 Message-ID: <86o6pouuua.wl-maz@kernel.org> From: Marc Zyngier To: Markus Elfring Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Andrew Walbran , Ayrton Munoz , Catalin Marinas , Joey Gouly , Oliver Upton , Per Larsen , Quentin Perret , Suzuki Poulouse , Will Deacon , Zenghui Yu , LKML , kernel-janitors@vger.kernel.org, Miaoqian Lin Subject: Re: [PATCH] KVM: arm64: FFA: Use pointers from memcpy() calls for assignments in three functions In-Reply-To: References: User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: Markus.Elfring@web.de, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, qwandor@google.com, ayrton@google.com, catalin.marinas@arm.com, joey.gouly@arm.com, oliver.upton@linux.dev, perlarsen@google.com, qperret@google.com, suzuki.poulose@arm.com, will@kernel.org, yuzenghui@huawei.com, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linmq006@gmail.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251030_110729_546369_B4955CD1 X-CRM114-Status: GOOD ( 22.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 30 Oct 2025 17:40:39 +0000, Markus Elfring wrote: > > From: Markus Elfring > 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 > --- > 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.