linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bpf: Make function btf_name_offset_valid static
@ 2019-01-16 19:29 Mathieu Malaterre
  2019-01-16 21:16 ` Martin Lau
  0 siblings, 1 reply; 3+ messages in thread
From: Mathieu Malaterre @ 2019-01-16 19:29 UTC (permalink / raw)
  To: Martin KaFai Lau
  Cc: Mathieu Malaterre, Alexei Starovoitov, Daniel Borkmann, netdev,
	linux-kernel

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]

Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
 kernel/bpf/btf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index a2f53642592b..befe570be5ba 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -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;
-- 
2.19.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] bpf: Make function btf_name_offset_valid static
  2019-01-16 19:29 [PATCH] bpf: Make function btf_name_offset_valid static Mathieu Malaterre
@ 2019-01-16 21:16 ` Martin Lau
  2019-01-17 15:56   ` Daniel Borkmann
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Lau @ 2019-01-16 21:16 UTC (permalink / raw)
  To: Mathieu Malaterre
  Cc: Alexei Starovoitov, Daniel Borkmann, netdev, linux-kernel

On Wed, Jan 16, 2019 at 08:29:40PM +0100, Mathieu Malaterre wrote:
> 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.
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")

> 
> 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 <malat@debian.org>
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 <kafai@fb.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] bpf: Make function btf_name_offset_valid static
  2019-01-16 21:16 ` Martin Lau
@ 2019-01-17 15:56   ` Daniel Borkmann
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2019-01-17 15:56 UTC (permalink / raw)
  To: Martin Lau, Mathieu Malaterre; +Cc: Alexei Starovoitov, netdev, linux-kernel

On 01/16/2019 10:16 PM, Martin Lau wrote:
> On Wed, Jan 16, 2019 at 08:29:40PM +0100, Mathieu Malaterre wrote:
>> 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.
> 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")
> 
>>
>> 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 <malat@debian.org>
> 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 <kafai@fb.com>

Applied to bpf and fixed up commit reference. Thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-17 15:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-16 19:29 [PATCH] bpf: Make function btf_name_offset_valid static Mathieu Malaterre
2019-01-16 21:16 ` Martin Lau
2019-01-17 15:56   ` Daniel Borkmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).