Skip to content

Commit 3b87251

Browse files
Yonghong SongAlexei Starovoitov
authored andcommitted
bpf: Simplify assignment to struct bpf_insn pointer in do_misc_fixups()
In verifier.c, the following code patterns (in two places) struct bpf_insn *patch = &insn_buf[0]; can be simplified to struct bpf_insn *patch = insn_buf; which is easier to understand. Acked-by: Eduard Zingerman <[email protected]> Signed-off-by: Yonghong Song <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 0325472 commit 3b87251

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/bpf/verifier.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22103,7 +22103,7 @@ static int do_misc_fixups(struct bpf_verifier_env *env)
2210322103
if (BPF_CLASS(insn->code) == BPF_LDX &&
2210422104
(BPF_MODE(insn->code) == BPF_PROBE_MEM ||
2210522105
BPF_MODE(insn->code) == BPF_PROBE_MEMSX)) {
22106-
struct bpf_insn *patch = &insn_buf[0];
22106+
struct bpf_insn *patch = insn_buf;
2210722107
u64 uaddress_limit = bpf_arch_uaddress_limit();
2210822108

2210922109
if (!uaddress_limit)
@@ -22154,7 +22154,7 @@ static int do_misc_fixups(struct bpf_verifier_env *env)
2215422154
insn->code == (BPF_ALU64 | BPF_SUB | BPF_X)) {
2215522155
const u8 code_add = BPF_ALU64 | BPF_ADD | BPF_X;
2215622156
const u8 code_sub = BPF_ALU64 | BPF_SUB | BPF_X;
22157-
struct bpf_insn *patch = &insn_buf[0];
22157+
struct bpf_insn *patch = insn_buf;
2215822158
bool issrc, isneg, isimm;
2215922159
u32 off_reg;
2216022160

0 commit comments

Comments
 (0)