[PATCH 1/2] x86/callthunks: s/bcmp/memcmp/

From: Mateusz Guzik
Date: Sat Nov 23 2024 - 04:47:58 EST


bcmp() is implemented as a call to memcmp() and callthunks is the only
consumer.

Use memcmp() directly so that bcmp() can get retired.

Signed-off-by: Mateusz Guzik <mjguzik@xxxxxxxxx>
---
arch/x86/kernel/callthunks.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/callthunks.c b/arch/x86/kernel/callthunks.c
index 465647456753..dda60b91944f 100644
--- a/arch/x86/kernel/callthunks.c
+++ b/arch/x86/kernel/callthunks.c
@@ -188,11 +188,11 @@ static void *patch_dest(void *dest, bool direct)
apply_relocation(insn_buff, pad, tsize, skl_call_thunk_template, tsize);

/* Already patched? */
- if (!bcmp(pad, insn_buff, tsize))
+ if (!memcmp(pad, insn_buff, tsize))
return pad;

/* Ensure there are nops */
- if (bcmp(pad, nops, tsize)) {
+ if (memcmp(pad, nops, tsize)) {
pr_warn_once("Invalid padding area for %pS\n", dest);
return NULL;
}
@@ -309,7 +309,7 @@ static bool is_callthunk(void *addr)
memcpy(insn_buff, skl_call_thunk_template, tmpl_size);
apply_relocation(insn_buff, pad, tmpl_size, skl_call_thunk_template, tmpl_size);

- return !bcmp(pad, insn_buff, tmpl_size);
+ return !memcmp(pad, insn_buff, tmpl_size);
}

int x86_call_depth_emit_accounting(u8 **pprog, void *func, void *ip)
--
2.43.0