提交 1fd71d8a 编写于 作者: A Andrii Nakryiko 提交者: Zheng Zengkai

libbpf: Fix non-C89 loop variable declaration in gen_loader.c

mainline inclusion
from mainline-5.17-rc1
commit b8b5cb55
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I5EUVD
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b8b5cb55f5d3f03cc1479a3768d68173a10359ad

-------------------------------------------------

Fix the `int i` declaration inside the for statement. This is non-C89
compliant. See [0] for user report breaking BCC build.

  [0] https://github.com/libbpf/libbpf/issues/403

Fixes: 18f4fccb ("libbpf: Update gen_loader to emit BTF_KIND_FUNC relocations")
Signed-off-by: NAndrii Nakryiko <andrii@kernel.org>
Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
Acked-by: NKumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/bpf/20211105191055.3324874-1-andrii@kernel.org
(cherry picked from commit b8b5cb55)
Signed-off-by: NWang Yufen <wangyufen@huawei.com>
上级 e52db245
...@@ -596,8 +596,9 @@ void bpf_gen__record_extern(struct bpf_gen *gen, const char *name, bool is_weak, ...@@ -596,8 +596,9 @@ void bpf_gen__record_extern(struct bpf_gen *gen, const char *name, bool is_weak,
static struct ksym_desc *get_ksym_desc(struct bpf_gen *gen, struct ksym_relo_desc *relo) static struct ksym_desc *get_ksym_desc(struct bpf_gen *gen, struct ksym_relo_desc *relo)
{ {
struct ksym_desc *kdesc; struct ksym_desc *kdesc;
int i;
for (int i = 0; i < gen->nr_ksyms; i++) { for (i = 0; i < gen->nr_ksyms; i++) {
if (!strcmp(gen->ksyms[i].name, relo->name)) { if (!strcmp(gen->ksyms[i].name, relo->name)) {
gen->ksyms[i].ref++; gen->ksyms[i].ref++;
return &gen->ksyms[i]; return &gen->ksyms[i];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册