Skip to content

Commit 96d31df

Browse files
shardulsb08Alexei Starovoitov
authored andcommitted
bpf: Clarify get_outer_instance() handling in propagate_to_outer_instance()
propagate_to_outer_instance() calls get_outer_instance() and uses the returned pointer to reset and commit stack write marks. Under normal conditions, update_instance() guarantees that an outer instance exists, so get_outer_instance() cannot return an ERR_PTR. However, explicitly checking for IS_ERR(outer_instance) makes this code more robust and self-documenting. It reduces cognitive load when reading the control flow and silences potential false-positive reports from static analysis or automated tooling. No functional change intended. Signed-off-by: Shardul Bankar <[email protected]> Acked-by: Eduard Zingerman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 04a8995 commit 96d31df

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/bpf/liveness.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,8 @@ static int propagate_to_outer_instance(struct bpf_verifier_env *env,
524524

525525
this_subprog_start = callchain_subprog_start(callchain);
526526
outer_instance = get_outer_instance(env, instance);
527+
if (IS_ERR(outer_instance))
528+
return PTR_ERR(outer_instance);
527529
callsite = callchain->callsites[callchain->curframe - 1];
528530

529531
reset_stack_write_marks(env, outer_instance, callsite);

0 commit comments

Comments
 (0)