* [PATCH bpf-next] libbpf: fix printf formatter for ptrdiff_t argument
@ 2019-04-16 18:47 andrii.nakryiko
2019-04-16 21:27 ` Song Liu
2019-04-17 2:45 ` Alexei Starovoitov
0 siblings, 2 replies; 4+ messages in thread
From: andrii.nakryiko @ 2019-04-16 18:47 UTC (permalink / raw)
To: andrii.nakryiko, netdev, bpf, evvers
Cc: Andrii Nakryiko, Daniel Borkmann, Alexei Starovoitov, Yonghong Song
From: Andrii Nakryiko <andriin@fb.com>
Using %ld for printing out value of ptrdiff_t type is not portable
between 32-bit and 64-bit archs. This is causing compilation errors for
libbpf on 32-bit platform (discovered as part of an effort to integrate
libbpf into systemd ([0])). Proper formatter is %td, which is used in
this patch.
v2->v1:
- add Reported-by
- provide more context on how this issue was discovered
[0] https://github.com/systemd/systemd/pull/12151
Reported-by: Evgeny Vereshchagin <evvers@ya.ru>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Yonghong Song <yhs@fb.com>
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
tools/lib/bpf/libbpf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index e5b77ad97795..d817bf20f3d6 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -817,7 +817,7 @@ bpf_object__init_internal_map(struct bpf_object *obj, struct bpf_map *map,
memcpy(*data_buff, data->d_buf, data->d_size);
}
- pr_debug("map %ld is \"%s\"\n", map - obj->maps, map->name);
+ pr_debug("map %td is \"%s\"\n", map - obj->maps, map->name);
return 0;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next] libbpf: fix printf formatter for ptrdiff_t argument
2019-04-16 18:47 [PATCH bpf-next] libbpf: fix printf formatter for ptrdiff_t argument andrii.nakryiko
@ 2019-04-16 21:27 ` Song Liu
2019-04-17 2:45 ` Alexei Starovoitov
1 sibling, 0 replies; 4+ messages in thread
From: Song Liu @ 2019-04-16 21:27 UTC (permalink / raw)
To: Andrii Nakryiko
Cc: Networking, bpf, evvers, Andrii Nakryiko, Daniel Borkmann,
Alexei Starovoitov, Yonghong Song
On Tue, Apr 16, 2019 at 11:47 AM <andrii.nakryiko@gmail.com> wrote:
>
> From: Andrii Nakryiko <andriin@fb.com>
>
> Using %ld for printing out value of ptrdiff_t type is not portable
> between 32-bit and 64-bit archs. This is causing compilation errors for
> libbpf on 32-bit platform (discovered as part of an effort to integrate
> libbpf into systemd ([0])). Proper formatter is %td, which is used in
> this patch.
>
> v2->v1:
> - add Reported-by
> - provide more context on how this issue was discovered
>
> [0] https://github.com/systemd/systemd/pull/12151
>
> Reported-by: Evgeny Vereshchagin <evvers@ya.ru>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: Alexei Starovoitov <ast@fb.com>
> Cc: Yonghong Song <yhs@fb.com>
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: Song Liu <songliubraving@fb.com>
> ---
> tools/lib/bpf/libbpf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index e5b77ad97795..d817bf20f3d6 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -817,7 +817,7 @@ bpf_object__init_internal_map(struct bpf_object *obj, struct bpf_map *map,
> memcpy(*data_buff, data->d_buf, data->d_size);
> }
>
> - pr_debug("map %ld is \"%s\"\n", map - obj->maps, map->name);
> + pr_debug("map %td is \"%s\"\n", map - obj->maps, map->name);
> return 0;
> }
>
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next] libbpf: fix printf formatter for ptrdiff_t argument
2019-04-16 18:47 [PATCH bpf-next] libbpf: fix printf formatter for ptrdiff_t argument andrii.nakryiko
2019-04-16 21:27 ` Song Liu
@ 2019-04-17 2:45 ` Alexei Starovoitov
1 sibling, 0 replies; 4+ messages in thread
From: Alexei Starovoitov @ 2019-04-17 2:45 UTC (permalink / raw)
To: Andrii Nakryiko
Cc: Network Development, bpf, evvers, Andrii Nakryiko,
Daniel Borkmann, Alexei Starovoitov, Yonghong Song
On Tue, Apr 16, 2019 at 11:47 AM <andrii.nakryiko@gmail.com> wrote:
>
> From: Andrii Nakryiko <andriin@fb.com>
>
> Using %ld for printing out value of ptrdiff_t type is not portable
> between 32-bit and 64-bit archs. This is causing compilation errors for
> libbpf on 32-bit platform (discovered as part of an effort to integrate
> libbpf into systemd ([0])). Proper formatter is %td, which is used in
> this patch.
>
> v2->v1:
> - add Reported-by
> - provide more context on how this issue was discovered
>
> [0] https://github.com/systemd/systemd/pull/12151
>
> Reported-by: Evgeny Vereshchagin <evvers@ya.ru>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: Alexei Starovoitov <ast@fb.com>
> Cc: Yonghong Song <yhs@fb.com>
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Applied. Thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH bpf-next] libbpf: fix printf formatter for ptrdiff_t argument
@ 2019-04-16 17:40 andrii.nakryiko
0 siblings, 0 replies; 4+ messages in thread
From: andrii.nakryiko @ 2019-04-16 17:40 UTC (permalink / raw)
To: andrii.nakryiko, netdev, bpf
Cc: Andrii Nakryiko, Daniel Borkmann, Alexei Starovoitov, Yonghong Song
From: Andrii Nakryiko <andriin@fb.com>
Using %ld for printing out value of ptrdiff_t type is not portable
between 32-bit and 64-bit archs. This is causing compilation errors for
libbpf on 32-bit platform. Proper formatter is %td, which is used in
this patch.
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Yonghong Song <yhs@fb.com>
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
tools/lib/bpf/libbpf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index e5b77ad97795..d817bf20f3d6 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -817,7 +817,7 @@ bpf_object__init_internal_map(struct bpf_object *obj, struct bpf_map *map,
memcpy(*data_buff, data->d_buf, data->d_size);
}
- pr_debug("map %ld is \"%s\"\n", map - obj->maps, map->name);
+ pr_debug("map %td is \"%s\"\n", map - obj->maps, map->name);
return 0;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-04-17 2:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-16 18:47 [PATCH bpf-next] libbpf: fix printf formatter for ptrdiff_t argument andrii.nakryiko
2019-04-16 21:27 ` Song Liu
2019-04-17 2:45 ` Alexei Starovoitov
-- strict thread matches above, loose matches on Subject: below --
2019-04-16 17:40 andrii.nakryiko
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).