Re: [PATCH RESEND bpf-next] bpf: Use common error handling code in bpf_is_state_visited()

From: Markus Elfring

Date: Mon Jun 22 2026 - 03:46:10 EST


>> Use an additional label so that a bit of exception handling can be better
>> reused at the end of this function implementation.
>>
>> This issue was detected by using the Coccinelle software.

>> +++ b/kernel/bpf/states.c

>> @@ -1588,4 +1583,9 @@ int bpf_is_state_visited(struct bpf_verifier_env *env, int insn_idx)
>> bpf_clear_jmp_history(cur);
>> list_add(&new_sl->node, head);
>> return 0;
>> +
>> +free_verifier_state:
>> + bpf_free_verifier_state(new, false);
>> + kfree(new_sl);
>> + return err;
>
> This function is full of 'goto's already.
> I prefer to keep the code as-is.

How does such a view fit to a known coding style recommendation?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v7.1#n526


How do you think about to increase the application of scope-based resource management?

Regards,
Markus