提交 eb1c6c21 编写于 作者: M Michal Suchanek 提交者: Zheng Zengkai

libbpf: Fix pr_warn type warnings on 32bit

mainline inclusion
from mainline-5.14-rc1
commit edc0571c
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=edc0571c5f67c7e24958149a8ec6a904ca84840b

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

The printed value is ptrdiff_t and is formatted wiht %ld. This works on
64bit but produces a warning on 32bit. Fix the format specifier to %td.

Fixes: 67234743 ("libbpf: Generate loader program out of BPF ELF file.")
Signed-off-by: NMichal Suchanek <msuchanek@suse.de>
Signed-off-by: NAndrii Nakryiko <andrii@kernel.org>
Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
Acked-by: NYonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20210604112448.32297-1-msuchanek@suse.de
(cherry picked from commit edc0571c)
Signed-off-by: NWang Yufen <wangyufen@huawei.com>
上级 6ade80ea
...@@ -4625,7 +4625,7 @@ static int init_map_slots(struct bpf_object *obj, struct bpf_map *map) ...@@ -4625,7 +4625,7 @@ static int init_map_slots(struct bpf_object *obj, struct bpf_map *map)
targ_map = map->init_slots[i]; targ_map = map->init_slots[i];
fd = bpf_map__fd(targ_map); fd = bpf_map__fd(targ_map);
if (obj->gen_loader) { if (obj->gen_loader) {
pr_warn("// TODO map_update_elem: idx %ld key %d value==map_idx %ld\n", pr_warn("// TODO map_update_elem: idx %td key %d value==map_idx %td\n",
map - obj->maps, i, targ_map - obj->maps); map - obj->maps, i, targ_map - obj->maps);
return -ENOTSUP; return -ENOTSUP;
} else { } else {
...@@ -6262,7 +6262,7 @@ static int bpf_core_apply_relo(struct bpf_program *prog, ...@@ -6262,7 +6262,7 @@ static int bpf_core_apply_relo(struct bpf_program *prog,
return -EINVAL; return -EINVAL;
if (prog->obj->gen_loader) { if (prog->obj->gen_loader) {
pr_warn("// TODO core_relo: prog %ld insn[%d] %s %s kind %d\n", pr_warn("// TODO core_relo: prog %td insn[%d] %s %s kind %d\n",
prog - prog->obj->programs, relo->insn_off / 8, prog - prog->obj->programs, relo->insn_off / 8,
local_name, spec_str, relo->kind); local_name, spec_str, relo->kind);
return -ENOTSUP; return -ENOTSUP;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册