[RFC bpf-next v2 3/6] bpf: rename bpf_copy_to_user().

thinker.li
2023-08-11T04:31:37Z

From: Kui-Feng Lee <thinker.li@gmail.com>

Rename bpf_copy_to_user() to avoid confliction with the BPF kfunc.

Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
---
kernel/bpf/syscall.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 7f4e8c357a6a..81b6e60cc030 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -3297,8 +3297,8 @@ static void bpf_raw_tp_link_show_fdinfo(const struct bpf_link *link,
raw_tp_link->btp->tp->name);
}

-static int bpf_copy_to_user(char __user *ubuf, const char *buf, u32 ulen,
- u32 len)
+static int _bpf_copy_to_user(char __user *ubuf, const char *buf, u32 ulen,
+ u32 len)
{
if (ulen >= len + 1) {
if (copy_to_user(ubuf, buf, len + 1))
@@ -3334,7 +3334,7 @@ static int bpf_raw_tp_link_fill_link_info(const struct bpf_link *link,
if (!ubuf)
return 0;

- return bpf_copy_to_user(ubuf, tp_name, ulen, tp_len);
+ return _bpf_copy_to_user(ubuf, tp_name, ulen, tp_len);
}

static const struct bpf_link_ops bpf_raw_tp_link_lops = {
@@ -3388,7 +3388,7 @@ static int bpf_perf_link_fill_common(const struct perf_event *event,

if (buf) {
len = strlen(buf);
- err = bpf_copy_to_user(uname, buf, ulen, len);
+ err = _bpf_copy_to_user(uname, buf, ulen, len);
if (err)
return err;
} else {
--
2.34.1