[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251103145706.2a419ad6@p-imbrenda>
Date: Mon, 3 Nov 2025 14:57:06 +0100
From: Claudio Imbrenda <imbrenda@...ux.ibm.com>
To: Markus Elfring <Markus.Elfring@....de>
Cc: linux-s390@...r.kernel.org, kvm@...r.kernel.org,
Alexander Gordeev
<agordeev@...ux.ibm.com>,
Christian Bornträger
<borntraeger@...ux.ibm.com>,
David Hildenbrand <david@...hat.com>,
Gerald
Schäfer <gerald.schaefer@...ux.ibm.com>,
Heiko Carstens
<hca@...ux.ibm.com>,
Janosch Frank <frankja@...ux.ibm.com>,
Sven Schnelle
<svens@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
LKML
<linux-kernel@...r.kernel.org>, kernel-janitors@...r.kernel.org,
Miaoqian
Lin <linmq006@...il.com>
Subject: Re: [PATCH] s390/mm: Use pointer from memcpy() call for assignment
in s390_replace_asce()
On Fri, 31 Oct 2025 08:22:30 +0100
Markus Elfring <Markus.Elfring@....de> wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Fri, 31 Oct 2025 07:56:06 +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/s390/mm/gmap.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c
> index 22c448b32340..e49e839933f1 100644
> --- a/arch/s390/mm/gmap.c
> +++ b/arch/s390/mm/gmap.c
> @@ -2440,8 +2440,8 @@ int s390_replace_asce(struct gmap *gmap)
> page = gmap_alloc_crst();
> if (!page)
> return -ENOMEM;
> - table = page_to_virt(page);
> - memcpy(table, gmap->table, 1UL << (CRST_ALLOC_ORDER + PAGE_SHIFT));
> +
> + table = memcpy(page_to_virt(page), gmap->table, 1UL << (CRST_ALLOC_ORDER + PAGE_SHIFT));
>
> /* Set new table origin while preserving existing ASCE control bits */
> asce = (gmap->asce & ~_ASCE_ORIGIN) | __pa(table);
NACK
1) the change makes the code less readable / understandable
2) mm/gmap.c is going away soon
Powered by blists - more mailing lists