Merge tag 'x86_core_for_5.18_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / kernel / bpf / trampoline.c
index 0b41fa9..ada9775 100644 (file)
@@ -117,18 +117,6 @@ static void bpf_trampoline_module_put(struct bpf_trampoline *tr)
        tr->mod = NULL;
 }
 
-static int is_ftrace_location(void *ip)
-{
-       long addr;
-
-       addr = ftrace_location((long)ip);
-       if (!addr)
-               return 0;
-       if (WARN_ON_ONCE(addr != (long)ip))
-               return -EFAULT;
-       return 1;
-}
-
 static int unregister_fentry(struct bpf_trampoline *tr, void *old_addr)
 {
        void *ip = tr->func.addr;
@@ -160,12 +148,12 @@ static int modify_fentry(struct bpf_trampoline *tr, void *old_addr, void *new_ad
 static int register_fentry(struct bpf_trampoline *tr, void *new_addr)
 {
        void *ip = tr->func.addr;
+       unsigned long faddr;
        int ret;
 
-       ret = is_ftrace_location(ip);
-       if (ret < 0)
-               return ret;
-       tr->func.ftrace_managed = ret;
+       faddr = ftrace_location((unsigned long)ip);
+       if (faddr)
+               tr->func.ftrace_managed = true;
 
        if (bpf_trampoline_module_get(tr))
                return -ENOENT;