[PATCH] x86/umip: Use pointer from memcpy() call for assignment in fixup_umip_exception()

Markus Elfring posted 1 patch 3 months, 1 week ago
arch/x86/kernel/umip.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] x86/umip: Use pointer from memcpy() call for assignment in fixup_umip_exception()
Posted by Markus Elfring 3 months, 1 week ago
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 31 Oct 2025 10:10:44 +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/x86/kernel/umip.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/umip.c b/arch/x86/kernel/umip.c
index d432f3824f0c..693905a363eb 100644
--- a/arch/x86/kernel/umip.c
+++ b/arch/x86/kernel/umip.c
@@ -398,8 +398,8 @@ bool fixup_umip_exception(struct pt_regs *regs)
 		if (reg_offset < 0)
 			return false;
 
-		reg_addr = (unsigned long *)((unsigned long)regs + reg_offset);
-		memcpy(reg_addr, dummy_data, dummy_data_size);
+		reg_addr = memcpy((unsigned long *)((unsigned long)regs + reg_offset),
+				  dummy_data, dummy_data_size);
 	} else {
 		uaddr = insn_get_addr_ref(&insn, regs);
 		if ((unsigned long)uaddr == -1L)
-- 
2.51.1