linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: arm64: Use pointer from memcpy() call for assignment in init_hyp_mode()
@ 2025-10-30 17:11 Markus Elfring
  2025-10-30 17:49 ` Mark Rutland
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2025-10-30 17:11 UTC (permalink / raw)
  To: kvmarm, linux-arm-kernel, Catalin Marinas, David Brazdil,
	Joey Gouly, Marc Zyngier, Oliver Upton, Suzuki Poulouse,
	Will Deacon, Zenghui Yu
  Cc: LKML, kernel-janitors, Miaoqian Lin

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 30 Oct 2025 18:01:41 +0100

A pointer was assigned to a variable. 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 two separate statements into a direct variable assignment for
the return value from a memory copy action.

The source code was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 arch/arm64/kvm/arm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
index 870953b4a8a7..feab88c31703 100644
--- a/arch/arm64/kvm/arm.c
+++ b/arch/arm64/kvm/arm.c
@@ -2600,8 +2600,8 @@ static int __init init_hyp_mode(void)
 			goto out_err;
 		}
 
-		page_addr = page_address(page);
-		memcpy(page_addr, CHOOSE_NVHE_SYM(__per_cpu_start), nvhe_percpu_size());
+		page_addr = memcpy(page_address(page), CHOOSE_NVHE_SYM(__per_cpu_start),
+				   nvhe_percpu_size());
 		kvm_nvhe_sym(kvm_arm_hyp_percpu_base)[cpu] = (unsigned long)page_addr;
 	}
 
-- 
2.51.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-10-30 21:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-30 17:11 [PATCH] KVM: arm64: Use pointer from memcpy() call for assignment in init_hyp_mode() Markus Elfring
2025-10-30 17:49 ` Mark Rutland
2025-10-30 21:21   ` David Laight

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).