lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aQOlPy7W6xljdkJW@J2N7QTR9R3>
Date: Thu, 30 Oct 2025 17:49:51 +0000
From: Mark Rutland <mark.rutland@....com>
To: Markus Elfring <Markus.Elfring@....de>
Cc: kvmarm@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
	Catalin Marinas <catalin.marinas@....com>,
	David Brazdil <dbrazdil@...gle.com>,
	Joey Gouly <joey.gouly@....com>, Marc Zyngier <maz@...nel.org>,
	Oliver Upton <oliver.upton@...ux.dev>,
	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: Use pointer from memcpy() call for
 assignment in init_hyp_mode()

On Thu, Oct 30, 2025 at 06:11:03PM +0100, Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.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@...rs.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());

This change makes the code harder to read, and harder to modify. It
saves no space.

As Dan said [1]:

| No one will thank you for making these changes...  :(  Please don't do
| it.

[1] https://lore.kernel.org/lkml/aQNsecHJSO2U68Fc@stanley.mountain/

Mark.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ