[PATCH] arm64: patching: Use uintptr_t in aarch64_insn_patch_text_nosync()

Thorsten Blum blum at kernel.org
Wed Nov 4 01:59:43 PST 2026


Use uintptr_t for tp instead of casting it multiple times and pass addr
directly to aarch64_insn_write().

Signed-off-by: Thorsten Blum <blum at kernel.org>
---
 arch/arm64/kernel/patching.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/kernel/patching.c b/arch/arm64/kernel/patching.c
index 09f019c6547a..24333419a8f1 100644
--- a/arch/arm64/kernel/patching.c
+++ b/arch/arm64/kernel/patching.c
@@ -178,17 +178,16 @@ noinstr void *aarch64_insn_set(void *dst, u32 insn, size_t len)
 
 int __kprobes aarch64_insn_patch_text_nosync(void *addr, u32 insn)
 {
-	u32 *tp = addr;
+	uintptr_t tp = (uintptr_t)addr;
 	int ret;
 
 	/* A64 instructions must be word aligned */
-	if ((uintptr_t)tp & 0x3)
+	if (tp & 0x3)
 		return -EINVAL;
 
-	ret = aarch64_insn_write(tp, insn);
+	ret = aarch64_insn_write(addr, insn);
 	if (ret == 0)
-		caches_clean_inval_pou((uintptr_t)tp,
-				     (uintptr_t)tp + AARCH64_INSN_SIZE);
+		caches_clean_inval_pou(tp, tp + AARCH64_INSN_SIZE);
 
 	return ret;
 }



More information about the linux-arm-kernel mailing list