From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sirio Balmelli Subject: [PATCH v2 1/1] tools/lib/libbpf.c: fix string format to allow build on arm32 Date: Wed, 23 May 2018 18:17:07 +0200 Message-ID: <20180523161704.4f5af2ehqdh6cqrh@vm4> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: netdev@vger.kernel.org To: daniel@iogearbox.net Return-path: Received: from mail-wm0-f50.google.com ([74.125.82.50]:33961 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754649AbeEWQRJ (ORCPT ); Wed, 23 May 2018 12:17:09 -0400 Received: by mail-wm0-f50.google.com with SMTP id q4-v6so3596805wmq.1 for ; Wed, 23 May 2018 09:17:09 -0700 (PDT) Content-Disposition: inline Sender: netdev-owner@vger.kernel.org List-ID: 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, typecast 'key_size' and amend format string. Signed-off-by: Sirio Balmelli --- tools/lib/bpf/libbpf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 8f1707dbfcfa..e5cd4a958846 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -1042,8 +1042,8 @@ 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", - map->name, name, key_size, def->key_size); + pr_warning("map:%s key_type:%s has BTF type_size:%u != key_size:%u\n", + map->name, name, (unsigned int)key_size, def->key_size); return -EINVAL; } @@ -1069,8 +1069,8 @@ 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", - map->name, name, value_size, def->value_size); + pr_warning("map:%s value_type:%s has BTF type_size:%u != value_size:%u\n", + map->name, name, (unsigned int)value_size, def->value_size); return -EINVAL; } -- 2.16.2