* [PATCH] s390/mm: Use pointer from memcpy() call for assignment in s390_replace_asce()
@ 2025-10-31 7:22 Markus Elfring
2025-11-03 13:57 ` Claudio Imbrenda
0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2025-10-31 7:22 UTC (permalink / raw)
To: linux-s390, kvm, Alexander Gordeev, Christian Bornträger,
Claudio Imbrenda, David Hildenbrand, Gerald Schäfer,
Heiko Carstens, Janosch Frank, Sven Schnelle, Vasily Gorbik
Cc: LKML, kernel-janitors, Miaoqian Lin
From: Markus Elfring <elfring@users.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@users.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);
--
2.51.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] s390/mm: Use pointer from memcpy() call for assignment in s390_replace_asce()
2025-10-31 7:22 [PATCH] s390/mm: Use pointer from memcpy() call for assignment in s390_replace_asce() Markus Elfring
@ 2025-11-03 13:57 ` Claudio Imbrenda
0 siblings, 0 replies; 2+ messages in thread
From: Claudio Imbrenda @ 2025-11-03 13:57 UTC (permalink / raw)
To: Markus Elfring
Cc: linux-s390, kvm, Alexander Gordeev, Christian Bornträger,
David Hildenbrand, Gerald Schäfer, Heiko Carstens,
Janosch Frank, Sven Schnelle, Vasily Gorbik, LKML,
kernel-janitors, Miaoqian Lin
On Fri, 31 Oct 2025 08:22:30 +0100
Markus Elfring <Markus.Elfring@web.de> wrote:
> From: Markus Elfring <elfring@users.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@users.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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-11-03 13:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-31 7:22 [PATCH] s390/mm: Use pointer from memcpy() call for assignment in s390_replace_asce() Markus Elfring
2025-11-03 13:57 ` Claudio Imbrenda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®