bpf: Make function btf_name_offset_valid static
Subsystems (3)
PATCH 1/1 bpf: Make function btf_name_offset_valid static
Initially in commit 69b693f0aefa ("bpf: btf: Introduce BPF Type Format (BTF)") the function 'btf_name_offset_valid' was introduced as static function it was later on changed to a non-static one, and then finally in commit c454a46b5efd ("bpf: Add bpf_line_info support") the function prototype was removed.
Revert back to original implementation and make the function static. Remove warning triggered with W=1:
kernel/bpf/btf.c:470:6: warning: no previous prototype for 'btf_name_offset_valid' [-Wmissing-prototypes]
--- kernel/bpf/btf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/btf.c +1 -1
@@ -467,7 +467,7 @@ static const struct btf_kind_operations *btf_type_ops(const struct btf_type *t)return kind_ops[BTF_INFO_KIND (t->info)]; } -bool btf_name_offset_valid (const struct btf *btf,u32 offset) +static bool btf_name_offset_valid (const struct btf *btf,u32 offset) {return BTF_STR_OFFSET_VALID (offset) && offset < btf->hdr.str_len;
Signature · 1 line
2.19.2
Quoted 5 lines · Mathieu Malaterre
Initially in commit
69b693f0aefa("bpf: btf: Introduce BPF Type Format (BTF)") the function 'btf_name_offset_valid' was introduced as static function it was later on changed to a non-static one, and then finally in commitc454a46b5efd("bpf: Addbpf_line_infosupport") the function prototype was removed.
Instead of c454a46b5efd, it was removed from btf.h in
commit 23127b33ec80 ("bpf: Create a new btf_name_by_offset() for non type name use case")
Quoted 7 lines
Revert back to original implementation and make the function static. Remove warning triggered with W=1:
kernel/bpf/btf.c:470:6: warning: no previous prototype for 'btf_name_offset_valid' [-Wmissing-prototypes]Signed-off-by Mathieu Malaterre <[email protected]>
Thanks for the fix!
Other than the above,
Quoted 15 lines · Martin Lau
Quoted 5 lines · Mathieu Malaterre
Initially in commit
69b693f0aefa("bpf: btf: Introduce BPF Type Format (BTF)") the function 'btf_name_offset_valid' was introduced as static function it was later on changed to a non-static one, and then finally in commitc454a46b5efd("bpf: Addbpf_line_infosupport") the function prototype was removed.Instead of
c454a46b5efd, it was removed frombtf.hin
commit23127b33ec80("bpf: Create a newbtf_name_by_offset()for non type name use case")Quoted 6 lines
Revert back to original implementation and make the function static. Remove warning triggered with W=1:
kernel/bpf/btf.c:470:6: warning: no previous prototype for 'btf_name_offset_valid' [-Wmissing-prototypes]
Quoted 8 lines
Quoted 1 line
Signed-off-by Mathieu Malaterre <[email protected]>Fixes 23127b33ec80 ("bpf: Create a new btf_name_by_offset() for non type name use case")Thanks for the fix!
Other than the above,
Acked-by Martin KaFai Lau <[email protected]>
Applied to bpf and fixed up commit reference. Thanks!