Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3694392ybv; Mon, 10 Feb 2020 04:51:25 -0800 (PST) X-Google-Smtp-Source: APXvYqwuLrOYuer0hcXt2kLzmapYNZkPe+Kv3pe8B282RiAtnMg5i7IbWI1B44ZuISVelbVv+baZ X-Received: by 2002:a9d:6e14:: with SMTP id e20mr948966otr.283.1581339085092; Mon, 10 Feb 2020 04:51:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581339085; cv=none; d=google.com; s=arc-20160816; b=XDYDgItXEWNpHn2dxbCbLhwQMs4WprCTvnIEHfQQfLKq6A7A1FatTTszlKuyaVlbas XTJuVNtq2y4TJAI8HvCDbx3pLh41I+Py+7HF2uib2oK1h0Kv12zFqZCqKm8urBf8Eao5 1WCbgrhV07o7X85o18WoxRklMsIlu9ttEx9am7BrUP4ZaMOKquykzSdpCvn9wBva/Zvd vW7yUOnE79l0ERSG0/+vVVAz+ENJldOV2mUjM8M36zIxDNdfQ4O5nbKuJiQf4se+3Mmd rV0Ie4PVUwhKO0ZZKktGlNAZYYX1XjjbRP0iD4p/Fpnxo/sUIOW32hFQu5WEHX13HL7o p8sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=L9lPFWAUcFrt7JXNpu+7iL/Cp/vXY1LNXLOhzd61cRg=; b=k4yZILFy8G80xzjF3Y6ltOirI+Xw3CUbol9CAMbzfHubBiQNP73MjSW4Zzw8Fymf7r eDKCQ/gRrD7Xo0YWp9JadT3iUboX24dW+jBB/ZRdqk9VFLo2TCUtXHKzl/XF2IB99id5 zNXxCyCJNEM5zY40KPfTOGnsuQajT6qyI9zaPODH6BDf6kuq3wd6dNq0zcL2DNY805mj R61viYGu6ycYLb2OZkt3CNk4sWBJ3g/h3/o0yr7z8dyhWNPGaWHejlfON6WQzUQbAgNc Qd4P3Ez4Tm0WI1ugAO6dN/7KdJrwN9KJl6bzYDwj5WBw+YvPaCMaeo13FLMBxm9uRxvX gLmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=D8AXpyiG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d22si133238oti.316.2020.02.10.04.51.13; Mon, 10 Feb 2020 04:51:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=D8AXpyiG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730642AbgBJMo0 (ORCPT + 99 others); Mon, 10 Feb 2020 07:44:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:40948 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729760AbgBJMkf (ORCPT ); Mon, 10 Feb 2020 07:40:35 -0500 Received: from localhost (unknown [209.37.97.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BACB420873; Mon, 10 Feb 2020 12:40:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338434; bh=A8OS+irv9ptR5X5lUbKiugMdJqyLkGJygP7rHJ61eSY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D8AXpyiGP/s34G2EwhuMdvJDNtki1kZSkLAQEAlOuPF7/W+Ou33pI3tnXNGJZAz8u lox5x1sFOOx6CCvSx0wrTWwb2fSFMmWrWjh0Se9OzYugpBQ8Zu4Y4nYdCNCscCJt9s f1HrdGY3kSSiG/ORKRCuWqh8F8Ji/ErfR1HOADrk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Nakryiko , Alexei Starovoitov , Martin KaFai Lau Subject: [PATCH 5.5 159/367] libbpf: Fix printf compilation warnings on ppc64le arch Date: Mon, 10 Feb 2020 04:31:12 -0800 Message-Id: <20200210122439.509830003@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrii Nakryiko commit 679152d3a32e305c213f83160c328c37566ae8bc upstream. On ppc64le __u64 and __s64 are defined as long int and unsigned long int, respectively. This causes compiler to emit warning when %lld/%llu are used to printf 64-bit numbers. Fix this by casting to size_t/ssize_t with %zu and %zd format specifiers, respectively. v1->v2: - use size_t/ssize_t instead of custom typedefs (Martin). Fixes: 1f8e2bcb2cd5 ("libbpf: Refactor relocation handling") Fixes: abd29c931459 ("libbpf: allow specifying map definitions using BTF") Signed-off-by: Andrii Nakryiko Signed-off-by: Alexei Starovoitov Acked-by: Martin KaFai Lau Link: https://lore.kernel.org/bpf/20191212171918.638010-1-andriin@fb.com Signed-off-by: Greg Kroah-Hartman --- tools/lib/bpf/libbpf.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -1242,15 +1242,15 @@ static int bpf_object__init_user_btf_map } sz = btf__resolve_size(obj->btf, t->type); if (sz < 0) { - pr_warn("map '%s': can't determine key size for type [%u]: %lld.\n", - map_name, t->type, sz); + pr_warn("map '%s': can't determine key size for type [%u]: %zd.\n", + map_name, t->type, (ssize_t)sz); return sz; } - pr_debug("map '%s': found key [%u], sz = %lld.\n", - map_name, t->type, sz); + pr_debug("map '%s': found key [%u], sz = %zd.\n", + map_name, t->type, (ssize_t)sz); if (map->def.key_size && map->def.key_size != sz) { - pr_warn("map '%s': conflicting key size %u != %lld.\n", - map_name, map->def.key_size, sz); + pr_warn("map '%s': conflicting key size %u != %zd.\n", + map_name, map->def.key_size, (ssize_t)sz); return -EINVAL; } map->def.key_size = sz; @@ -1285,15 +1285,15 @@ static int bpf_object__init_user_btf_map } sz = btf__resolve_size(obj->btf, t->type); if (sz < 0) { - pr_warn("map '%s': can't determine value size for type [%u]: %lld.\n", - map_name, t->type, sz); + pr_warn("map '%s': can't determine value size for type [%u]: %zd.\n", + map_name, t->type, (ssize_t)sz); return sz; } - pr_debug("map '%s': found value [%u], sz = %lld.\n", - map_name, t->type, sz); + pr_debug("map '%s': found value [%u], sz = %zd.\n", + map_name, t->type, (ssize_t)sz); if (map->def.value_size && map->def.value_size != sz) { - pr_warn("map '%s': conflicting value size %u != %lld.\n", - map_name, map->def.value_size, sz); + pr_warn("map '%s': conflicting value size %u != %zd.\n", + map_name, map->def.value_size, (ssize_t)sz); return -EINVAL; } map->def.value_size = sz; @@ -1817,7 +1817,8 @@ static int bpf_program__record_reloc(str return -LIBBPF_ERRNO__RELOC; } if (sym->st_value % 8) { - pr_warn("bad call relo offset: %llu\n", (__u64)sym->st_value); + pr_warn("bad call relo offset: %zu\n", + (size_t)sym->st_value); return -LIBBPF_ERRNO__RELOC; } reloc_desc->type = RELO_CALL; @@ -1859,8 +1860,8 @@ static int bpf_program__record_reloc(str break; } if (map_idx >= nr_maps) { - pr_warn("map relo failed to find map for sec %u, off %llu\n", - shdr_idx, (__u64)sym->st_value); + pr_warn("map relo failed to find map for sec %u, off %zu\n", + shdr_idx, (size_t)sym->st_value); return -LIBBPF_ERRNO__RELOC; } reloc_desc->type = RELO_LD64; @@ -1941,9 +1942,9 @@ bpf_program__collect_reloc(struct bpf_pr name = elf_strptr(obj->efile.elf, obj->efile.strtabidx, sym.st_name) ? : ""; - pr_debug("relo for shdr %u, symb %llu, value %llu, type %d, bind %d, name %d (\'%s\'), insn %u\n", - (__u32)sym.st_shndx, (__u64)GELF_R_SYM(rel.r_info), - (__u64)sym.st_value, GELF_ST_TYPE(sym.st_info), + pr_debug("relo for shdr %u, symb %zu, value %zu, type %d, bind %d, name %d (\'%s\'), insn %u\n", + (__u32)sym.st_shndx, (size_t)GELF_R_SYM(rel.r_info), + (size_t)sym.st_value, GELF_ST_TYPE(sym.st_info), GELF_ST_BIND(sym.st_info), sym.st_name, name, insn_idx);