bpf: liveness: clarify get_outer_instance() handling in propagate_to_outer_instance()
PATCH v3 1/1 bpf: liveness: 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.
--- kernel/bpf/liveness.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/bpf/liveness.c +2 -0
@@ -522,6 +522,8 @@ static int propagate_to_outer_instance(struct bpf_verifier_env *env, this_subprog_start =callchain_subprog_start (callchain); outer_instance =get_outer_instance (env, instance); +if (IS_ERR (outer_instance)) +return PTR_ERR (outer_instance); callsite = callchain->callsites[callchain->curframe -1 ];reset_stack_write_marks (env, outer_instance, callsite);
Signature · 1 line
2.34.1
Quoted 10 lines · Shardul Bankar
propagate_to_outer_instance()callsget_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, soget_outer_instance()cannot return anERR_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.
Quoted 6 lines
No functional change intended.
Reported-by kernel-patches-review-bot (https://github.com/kernel-patches/bpf/pull/10006#issuecomment-3409419240)Suggested-by Eduard Zingerman <[email protected]>Signed-off-by Shardul Bankar <[email protected]>---
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Quoted 11 lines · On Tue, 21 Oct 2025 13:38:46 +0530 you wrote:
propagate_to_outer_instance()callsget_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, soget_outer_instance()cannot return anERR_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.[...]
Here is the summary with links:
- [v3,bpf] bpf: liveness: clarify get_outer_instance() handling in propagate_to_outer_instance()
https://git.kernel.org/bpf/bpf-next/c/96d31dff3fa4
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html