Skip to content

Commit cb070a8

Browse files
eddyz87Alexei Starovoitov
authored andcommitted
bpf: removed unused 'env' parameter from is_reg64 and insn_has_def32
Parameter 'env' is not used by is_reg64() and insn_has_def32() functions. Remove the parameter to make it clear that neither function depends on 'env' state, e.g. env->insn_aux_data. Signed-off-by: Eduard Zingerman <[email protected]> Acked-by: Kumar Kartikeya Dwivedi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 911c035 commit cb070a8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

kernel/bpf/verifier.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3663,7 +3663,7 @@ static int mark_irq_flag_read(struct bpf_verifier_env *env, struct bpf_reg_state
36633663
* code only. It returns TRUE if the source or destination register operates
36643664
* on 64-bit, otherwise return FALSE.
36653665
*/
3666-
static bool is_reg64(struct bpf_verifier_env *env, struct bpf_insn *insn,
3666+
static bool is_reg64(struct bpf_insn *insn,
36673667
u32 regno, struct bpf_reg_state *reg, enum reg_arg_type t)
36683668
{
36693669
u8 code, class, op;
@@ -3774,14 +3774,14 @@ static int insn_def_regno(const struct bpf_insn *insn)
37743774
}
37753775

37763776
/* Return TRUE if INSN has defined any 32-bit value explicitly. */
3777-
static bool insn_has_def32(struct bpf_verifier_env *env, struct bpf_insn *insn)
3777+
static bool insn_has_def32(struct bpf_insn *insn)
37783778
{
37793779
int dst_reg = insn_def_regno(insn);
37803780

37813781
if (dst_reg == -1)
37823782
return false;
37833783

3784-
return !is_reg64(env, insn, dst_reg, NULL, DST_OP);
3784+
return !is_reg64(insn, dst_reg, NULL, DST_OP);
37853785
}
37863786

37873787
static void mark_insn_zext(struct bpf_verifier_env *env,
@@ -3812,7 +3812,7 @@ static int __check_reg_arg(struct bpf_verifier_env *env, struct bpf_reg_state *r
38123812
mark_reg_scratched(env, regno);
38133813

38143814
reg = &regs[regno];
3815-
rw64 = is_reg64(env, insn, regno, reg, t);
3815+
rw64 = is_reg64(insn, regno, reg, t);
38163816
if (t == SRC_OP) {
38173817
/* check whether register used as source operand can be read */
38183818
if (reg->type == NOT_INIT) {
@@ -20712,7 +20712,7 @@ static void adjust_insn_aux_data(struct bpf_verifier_env *env,
2071220712
* (cnt == 1) is taken or not. There is no guarantee INSN at OFF is the
2071320713
* original insn at old prog.
2071420714
*/
20715-
old_data[off].zext_dst = insn_has_def32(env, insn + off + cnt - 1);
20715+
old_data[off].zext_dst = insn_has_def32(insn + off + cnt - 1);
2071620716

2071720717
if (cnt == 1)
2071820718
return;
@@ -20724,7 +20724,7 @@ static void adjust_insn_aux_data(struct bpf_verifier_env *env,
2072420724
for (i = off; i < off + cnt - 1; i++) {
2072520725
/* Expand insni[off]'s seen count to the patched range. */
2072620726
new_data[i].seen = old_seen;
20727-
new_data[i].zext_dst = insn_has_def32(env, insn + i);
20727+
new_data[i].zext_dst = insn_has_def32(insn + i);
2072820728
}
2072920729
env->insn_aux_data = new_data;
2073020730
vfree(old_data);
@@ -21131,7 +21131,7 @@ static int opt_subreg_zext_lo32_rnd_hi32(struct bpf_verifier_env *env,
2113121131
* BPF_STX + SRC_OP, so it is safe to pass NULL
2113221132
* here.
2113321133
*/
21134-
if (is_reg64(env, &insn, load_reg, NULL, DST_OP)) {
21134+
if (is_reg64(&insn, load_reg, NULL, DST_OP)) {
2113521135
if (class == BPF_LD &&
2113621136
BPF_MODE(code) == BPF_IMM)
2113721137
i++;

0 commit comments

Comments
 (0)