Skip to content

Commit d297ccb

Browse files
eddyz87Alexei Starovoitov
authored andcommitted
bpf: move REG_LIVE_DONE check to clean_live_states()
The next patch would add some relatively heavy-weight operation to clean_live_states(), this operation can be skipped if REG_LIVE_DONE is set. Move the check from clean_verifier_state() to clean_verifier_state() as a small refactoring commit. Signed-off-by: Eduard Zingerman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 6b3f95c commit d297ccb

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

kernel/bpf/verifier.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18305,10 +18305,6 @@ static void clean_verifier_state(struct bpf_verifier_env *env,
1830518305
{
1830618306
int i;
1830718307

18308-
if (st->frame[0]->regs[0].live & REG_LIVE_DONE)
18309-
/* all regs in this state in all frames were already marked */
18310-
return;
18311-
1831218308
for (i = 0; i <= st->curframe; i++)
1831318309
clean_func_state(env, st->frame[i]);
1831418310
}
@@ -18363,6 +18359,9 @@ static void clean_live_states(struct bpf_verifier_env *env, int insn,
1836318359
if (sl->state.insn_idx != insn ||
1836418360
!same_callsites(&sl->state, cur))
1836518361
continue;
18362+
if (sl->state.frame[0]->regs[0].live & REG_LIVE_DONE)
18363+
/* all regs in this state in all frames were already marked */
18364+
continue;
1836618365
clean_verifier_state(env, &sl->state);
1836718366
}
1836818367
}

0 commit comments

Comments
 (0)