kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/umip: Use pointer from memcpy() call for assignment in fixup_umip_exception()
@ 2025-10-31  9:30 Markus Elfring
  0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2025-10-31  9:30 UTC (permalink / raw)
  To: x86, Borislav Petkov, Dave Hansen, H. Peter Anvin, Ingo Molnar,
	Peter Zijlstra, Ricardo Neri, Sean Christopherson,
	Thomas Gleixner
  Cc: LKML, kernel-janitors, Andrew Morton, Andy Lutomirski,
	Borislav Petkov, Brian Gerst, Chen Yucong, Chris Metcalf,
	Denys Vlasenko, Miaoqian Lin

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-10-31  9:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-31  9:30 [PATCH] x86/umip: Use pointer from memcpy() call for assignment in fixup_umip_exception() Markus Elfring

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