public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: 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>, Marc Zyngier <maz@kernel.org>,
	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>
Cc: LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org,
	Miaoqian Lin <linmq006@gmail.com>
Subject: [PATCH] KVM: arm64: FFA: Use pointers from memcpy() calls for assignments in three functions
Date: Thu, 30 Oct 2025 18:40:39 +0100	[thread overview]
Message-ID: <cb3bd42f-4fec-4300-8875-b6861716f274@web.de> (raw)

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);
 
 	ret = ffa_host_share_ranges(buf, nr_ranges);
@@ -505,8 +504,7 @@ static void __do_ffa_mem_xfer(const u64 func_id,
 		goto out_unlock;
 	}
 
-	buf = hyp_buffers.tx;
-	memcpy(buf, host_buffers.tx, fraglen);
+	buf = memcpy(hyp_buffers.tx, host_buffers.tx, fraglen);
 
 	ep_mem_access = (void *)buf +
 			ffa_mem_desc_offset(buf, 0, hyp_ffa_version);
@@ -615,8 +613,7 @@ static void do_ffa_mem_reclaim(struct arm_smccc_1_2_regs *res,
 		goto out_unlock;
 	}
 
-	buf = ffa_desc_buf.buf;
-	memcpy(buf, hyp_buffers.rx, fraglen);
+	buf = memcpy(ffa_desc_buf.buf, hyp_buffers.rx, fraglen);
 	ffa_rx_release(res);
 
 	for (fragoff = fraglen; fragoff < len; fragoff += fraglen) {
-- 
2.51.1


             reply	other threads:[~2025-10-30 17:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-30 17:40 Markus Elfring [this message]
2025-10-30 18:07 ` [PATCH] KVM: arm64: FFA: Use pointers from memcpy() calls for assignments in three functions Marc Zyngier

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=cb3bd42f-4fec-4300-8875-b6861716f274@web.de \
    --to=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=maz@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