From: Sirio Balmelli <sirio@b-ad.ch>
To: daniel@iogearbox.net
Cc: netdev@vger.kernel.org
Subject: [PATCH 1/1] tools/lib/libbpf.c: fix string format to allow build on arm32
Date: Mon, 21 May 2018 08:59:41 +0200 [thread overview]
Message-ID: <20180521065940.srb4rqwaohkn43i6@vm4> (raw)
On arm32, 'cd tools/testing/selftests/bpf && make' fails with:
libbpf.c:80:10: error: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘int64_t {aka long long int}’ [-Werror=format=]
(func)("libbpf: " fmt, ##__VA_ARGS__); \
^
libbpf.c:83:30: note: in expansion of macro ‘__pr’
#define pr_warning(fmt, ...) __pr(__pr_warning, fmt, ##__VA_ARGS__)
^~~~
libbpf.c:1072:3: note: in expansion of macro ‘pr_warning’
pr_warning("map:%s value_type:%s has BTF type_size:%ld != value_size:%u\n",
To fix, include 'inttypes.h' and change format directive to 'PRIi64'.
Signed-off-by: Sirio Balmelli <sirio@b-ad.ch>
---
tools/lib/bpf/libbpf.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 3dbe217bf23e..e2cc8f10c188 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -48,6 +48,8 @@
#include "bpf.h"
#include "btf.h"
+#include <inttypes.h> /* PRIi64 */
+
#ifndef EM_BPF
#define EM_BPF 247
#endif
@@ -1042,7 +1044,7 @@ static int bpf_map_find_btf_info(struct bpf_map *map, const struct btf *btf)
}
if (def->key_size != key_size) {
- pr_warning("map:%s key_type:%s has BTF type_size:%ld != key_size:%u\n",
+ pr_warning("map:%s key_type:%s has BTF type_size:%"PRIi64" != key_size:%u\n",
map->name, name, key_size, def->key_size);
return -EINVAL;
}
@@ -1069,7 +1071,7 @@ static int bpf_map_find_btf_info(struct bpf_map *map, const struct btf *btf)
}
if (def->value_size != value_size) {
- pr_warning("map:%s value_type:%s has BTF type_size:%ld != value_size:%u\n",
+ pr_warning("map:%s value_type:%s has BTF type_size:%"PRIi64" != value_size:%u\n",
map->name, name, value_size, def->value_size);
return -EINVAL;
}
--
2.16.2
next reply other threads:[~2018-05-21 6:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-21 6:59 Sirio Balmelli [this message]
2018-05-23 10:41 ` [PATCH 1/1] tools/lib/libbpf.c: fix string format to allow build on arm32 Daniel Borkmann
2018-05-23 15:49 ` Martin KaFai Lau
2018-05-23 16:16 ` Sirio Balmelli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180521065940.srb4rqwaohkn43i6@vm4 \
--to=sirio@b-ad.ch \
--cc=daniel@iogearbox.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox