diff options
author | Alexei Starovoitov <ast@kernel.org> | 2021-09-28 16:27:18 -0700 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2021-09-28 16:27:19 -0700 |
commit | 72e1781a5de9e3ee804e24f7ce9a7dd85596fc51 (patch) | |
tree | 18cfa723e40dbe24928faf0299bf0b90e8df9f43 /kernel/bpf/helpers.c | |
parent | 09710d82c0a3469eadc32781721ac2336fdf915d (diff) | |
parent | 102acbacfd9a96d101abd96d1a7a5bf92b7c3e8e (diff) |
Merge branch 'bpf: Build with -Wcast-function-type'
Kees Cook says:
====================
Hi,
In order to keep ahead of cases in the kernel where Control Flow Integrity
(CFI) may trip over function call casts, enabling -Wcast-function-type
is helpful. To that end, replace BPF_CAST_CALL() as it triggers warnings
with this option and is now one of the last places in the kernel in need
of fixing.
Thanks,
-Kees
v2:
- rebase to bpf-next
- add acks
v1: https://lore.kernel.org/lkml/20210927182700.2980499-1-keescook@chromium.org
====================
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'kernel/bpf/helpers.c')
-rw-r--r-- | kernel/bpf/helpers.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c index 2c604ff8c7fb..1ffd469c217f 100644 --- a/kernel/bpf/helpers.c +++ b/kernel/bpf/helpers.c @@ -1056,7 +1056,7 @@ static enum hrtimer_restart bpf_timer_cb(struct hrtimer *hrtimer) struct bpf_hrtimer *t = container_of(hrtimer, struct bpf_hrtimer, timer); struct bpf_map *map = t->map; void *value = t->value; - void *callback_fn; + bpf_callback_t callback_fn; void *key; u32 idx; @@ -1081,8 +1081,7 @@ static enum hrtimer_restart bpf_timer_cb(struct hrtimer *hrtimer) key = value - round_up(map->key_size, 8); } - BPF_CAST_CALL(callback_fn)((u64)(long)map, (u64)(long)key, - (u64)(long)value, 0, 0); + callback_fn((u64)(long)map, (u64)(long)key, (u64)(long)value, 0, 0); /* The verifier checked that return value is zero. */ this_cpu_write(hrtimer_running, NULL); |