[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190906073144.31068-7-jolsa@kernel.org>
Date: Fri, 6 Sep 2019 09:31:43 +0200
From: Jiri Olsa <jolsa@...nel.org>
To: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>
Cc: netdev@...r.kernel.org, bpf@...r.kernel.org,
Andrii Nakryiko <andriin@...com>, Yonghong Song <yhs@...com>,
Martin KaFai Lau <kafai@...com>
Subject: [PATCH 6/7] libbpf: Return const btf_var from btf_var inline function
I'm getting following errors when compiling with -Wcast-qual:
bpf/btf.h: In function ‘btf_var* btf_var(const btf_type*)’:
bpf/btf.h:296:33: warning: cast from type ‘const btf_type*’ to type
‘btf_var*’ casts away qualifiers [-Wcast-qual]
296 | return (struct btf_var *)(t + 1);
| ^
The argument is const so the cast to following struct btf_var
pointer should be const as well.
Signed-off-by: Jiri Olsa <jolsa@...nel.org>
---
tools/lib/bpf/btf.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h
index 2817cf7ce2ee..480dbe780fa7 100644
--- a/tools/lib/bpf/btf.h
+++ b/tools/lib/bpf/btf.h
@@ -291,9 +291,9 @@ static inline const struct btf_param *btf_params(const struct btf_type *t)
return (const struct btf_param *)(t + 1);
}
-static inline struct btf_var *btf_var(const struct btf_type *t)
+static inline const struct btf_var *btf_var(const struct btf_type *t)
{
- return (struct btf_var *)(t + 1);
+ return (const struct btf_var *)(t + 1);
}
static inline struct btf_var_secinfo *
--
2.21.0
Powered by blists - more mailing lists