Skip to content

Commit 3c4e420

Browse files
eddyz87Alexei Starovoitov
authored andcommitted
bpf: move explored_state() closer to the beginning of verifier.c
Subsequent patches would make use of explored_state() function. Move it up to avoid adding unnecessary prototype. Signed-off-by: Eduard Zingerman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent b63dadd commit 3c4e420

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

kernel/bpf/verifier.c

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,6 +1817,19 @@ static int copy_verifier_state(struct bpf_verifier_state *dst_state,
18171817
return 0;
18181818
}
18191819

1820+
static u32 state_htab_size(struct bpf_verifier_env *env)
1821+
{
1822+
return env->prog->len;
1823+
}
1824+
1825+
static struct bpf_verifier_state_list **explored_state(struct bpf_verifier_env *env, int idx)
1826+
{
1827+
struct bpf_verifier_state *cur = env->cur_state;
1828+
struct bpf_func_state *state = cur->frame[cur->curframe];
1829+
1830+
return &env->explored_states[(idx ^ state->callsite) % state_htab_size(env)];
1831+
}
1832+
18201833
static void update_branch_counts(struct bpf_verifier_env *env, struct bpf_verifier_state *st)
18211834
{
18221835
while (st) {
@@ -15020,21 +15033,6 @@ enum {
1502015033
BRANCH = 2,
1502115034
};
1502215035

15023-
static u32 state_htab_size(struct bpf_verifier_env *env)
15024-
{
15025-
return env->prog->len;
15026-
}
15027-
15028-
static struct bpf_verifier_state_list **explored_state(
15029-
struct bpf_verifier_env *env,
15030-
int idx)
15031-
{
15032-
struct bpf_verifier_state *cur = env->cur_state;
15033-
struct bpf_func_state *state = cur->frame[cur->curframe];
15034-
15035-
return &env->explored_states[(idx ^ state->callsite) % state_htab_size(env)];
15036-
}
15037-
1503815036
static void mark_prune_point(struct bpf_verifier_env *env, int idx)
1503915037
{
1504015038
env->insn_aux_data[idx].prune_point = true;

0 commit comments

Comments
 (0)