diff options
| -rw-r--r-- | arch/x86/net/bpf_jit_comp.c | 4 | ||||
| -rw-r--r-- | include/uapi/linux/bpf.h | 2 | ||||
| -rw-r--r-- | kernel/bpf/core.c | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c index 8c9573660d51..0554e8aef4d5 100644 --- a/arch/x86/net/bpf_jit_comp.c +++ b/arch/x86/net/bpf_jit_comp.c | |||
| @@ -284,9 +284,9 @@ static void emit_bpf_tail_call(u8 **pprog) | |||
| 284 | /* if (index >= array->map.max_entries) | 284 | /* if (index >= array->map.max_entries) |
| 285 | * goto out; | 285 | * goto out; |
| 286 | */ | 286 | */ |
| 287 | EMIT4(0x48, 0x8B, 0x46, /* mov rax, qword ptr [rsi + 16] */ | 287 | EMIT2(0x89, 0xD2); /* mov edx, edx */ |
| 288 | EMIT3(0x39, 0x56, /* cmp dword ptr [rsi + 16], edx */ | ||
| 288 | offsetof(struct bpf_array, map.max_entries)); | 289 | offsetof(struct bpf_array, map.max_entries)); |
| 289 | EMIT3(0x48, 0x39, 0xD0); /* cmp rax, rdx */ | ||
| 290 | #define OFFSET1 43 /* number of bytes to jump */ | 290 | #define OFFSET1 43 /* number of bytes to jump */ |
| 291 | EMIT2(X86_JBE, OFFSET1); /* jbe out */ | 291 | EMIT2(X86_JBE, OFFSET1); /* jbe out */ |
| 292 | label1 = cnt; | 292 | label1 = cnt; |
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index 43ab5c402f98..f90860d1f897 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h | |||
| @@ -312,7 +312,7 @@ union bpf_attr { | |||
| 312 | * jump into another BPF program | 312 | * jump into another BPF program |
| 313 | * @ctx: context pointer passed to next program | 313 | * @ctx: context pointer passed to next program |
| 314 | * @prog_array_map: pointer to map which type is BPF_MAP_TYPE_PROG_ARRAY | 314 | * @prog_array_map: pointer to map which type is BPF_MAP_TYPE_PROG_ARRAY |
| 315 | * @index: index inside array that selects specific program to run | 315 | * @index: 32-bit index inside array that selects specific program to run |
| 316 | * Return: 0 on success or negative error | 316 | * Return: 0 on success or negative error |
| 317 | * | 317 | * |
| 318 | * int bpf_clone_redirect(skb, ifindex, flags) | 318 | * int bpf_clone_redirect(skb, ifindex, flags) |
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 917cc04a0a94..7b62df86be1d 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c | |||
| @@ -1022,7 +1022,7 @@ select_insn: | |||
| 1022 | struct bpf_map *map = (struct bpf_map *) (unsigned long) BPF_R2; | 1022 | struct bpf_map *map = (struct bpf_map *) (unsigned long) BPF_R2; |
| 1023 | struct bpf_array *array = container_of(map, struct bpf_array, map); | 1023 | struct bpf_array *array = container_of(map, struct bpf_array, map); |
| 1024 | struct bpf_prog *prog; | 1024 | struct bpf_prog *prog; |
| 1025 | u64 index = BPF_R3; | 1025 | u32 index = BPF_R3; |
| 1026 | 1026 | ||
| 1027 | if (unlikely(index >= array->map.max_entries)) | 1027 | if (unlikely(index >= array->map.max_entries)) |
| 1028 | goto out; | 1028 | goto out; |
