From patchwork Thu Apr 14 22:46:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 12814096 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3712BC4332F for ; Thu, 14 Apr 2022 22:46:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347296AbiDNWtD (ORCPT ); Thu, 14 Apr 2022 18:49:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347277AbiDNWs7 (ORCPT ); Thu, 14 Apr 2022 18:48:59 -0400 Received: from mail-40134.protonmail.ch (mail-40134.protonmail.ch [185.70.40.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86956C6F00; Thu, 14 Apr 2022 15:46:32 -0700 (PDT) Date: Thu, 14 Apr 2022 22:46:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail2; t=1649976390; bh=LiFwMTDd2fdSlZNNJT9AWOWlwaivKQ5qk8KaEcQEfrs=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To: References:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID; b=fiN8lGwSeXi6yQVq95169CY5q0fzkvN7gW6UYs2Gv4qL+WDStjwwjCQh0hCFYvksU KnswdJkdUtU5G9GqL5Gxkii4Kk5V4ypSMXwAFRhB8ERjsorTeeAsUqVoT+zdEMMnjf oJiycRhG9r7gmPG8gH0louf++DYLLAv75knuCVPX+ca7M2uTv/1VQdT18IzG6xzs/a 6g4MF5ZXxirNHeYPobCikPiutt8fL50asp7vfCzUqKz1WsQRnWgrgFEHA5NMdKI4K0 ZaO3DghoEjFcnwImnLGE3V49hSOiewYZfIPHt/9yi4wVZ+k81z8SzXwdnbzSqnD24V tQqte9gKKFnUQ== To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko From: Alexander Lobakin Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Jonathan Lemon , Nathan Chancellor , Nick Desaulniers , Alexander Lobakin , Dmitrii Dolgov <9erthalion6@gmail.com>, Quentin Monnet , Tiezhu Yang , Kumar Kartikeya Dwivedi , Chenbo Feng , Willem de Bruijn , Daniel Wagner , Thomas Graf , Ong Boon Leong , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, llvm@lists.linux.dev Reply-To: Alexander Lobakin Subject: [PATCH bpf-next 07/11] samples: bpf: fix uin64_t format literals Message-ID: <20220414223704.341028-8-alobakin@pm.me> In-Reply-To: <20220414223704.341028-1-alobakin@pm.me> References: <20220414223704.341028-1-alobakin@pm.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: bpf@iogearbox.net There's a couple places where uin64_t is being passed as an %ld format argument, which is incorrect (should be %lld). Fix them. Fixes: 51570a5ab2b7 ("A Sample of using socket cookie and uid for traffic monitoring") Fixes: 00f660eaf378 ("Sample program using SO_COOKIE") Signed-off-by: Alexander Lobakin --- samples/bpf/cookie_uid_helper_example.c | 12 ++++++------ samples/bpf/lwt_len_hist_user.c | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) -- 2.35.2 diff --git a/samples/bpf/cookie_uid_helper_example.c b/samples/bpf/cookie_uid_helper_example.c index f0df3dda4b1f..1b98debb6019 100644 --- a/samples/bpf/cookie_uid_helper_example.c +++ b/samples/bpf/cookie_uid_helper_example.c @@ -207,9 +207,9 @@ static void print_table(void) error(1, errno, "fail to get entry value of Key: %u\n", curN); } else { - printf("cookie: %u, uid: 0x%x, Packet Count: %lu," - " Bytes Count: %lu\n", curN, curEntry.uid, - curEntry.packets, curEntry.bytes); + printf("cookie: %u, uid: 0x%x, Packet Count: %llu, Bytes Count: %llu\n", + curN, curEntry.uid, curEntry.packets, + curEntry.bytes); } } } @@ -265,9 +265,9 @@ static void udp_client(void) if (res < 0) error(1, errno, "lookup sk stat failed, cookie: %lu\n", cookie); - printf("cookie: %lu, uid: 0x%x, Packet Count: %lu," - " Bytes Count: %lu\n\n", cookie, dataEntry.uid, - dataEntry.packets, dataEntry.bytes); + printf("cookie: %llu, uid: 0x%x, Packet Count: %llu, Bytes Count: %llu\n\n", + cookie, dataEntry.uid, dataEntry.packets, + dataEntry.bytes); } close(s_send); close(s_rcv); diff --git a/samples/bpf/lwt_len_hist_user.c b/samples/bpf/lwt_len_hist_user.c index 430a4b7e353e..4ef22571aa67 100644 --- a/samples/bpf/lwt_len_hist_user.c +++ b/samples/bpf/lwt_len_hist_user.c @@ -44,7 +44,7 @@ int main(int argc, char **argv) while (bpf_map_get_next_key(map_fd, &key, &next_key) == 0) { if (next_key >= MAX_INDEX) { - fprintf(stderr, "Key %lu out of bounds\n", next_key); + fprintf(stderr, "Key %llu out of bounds\n", next_key); continue; } @@ -66,7 +66,7 @@ int main(int argc, char **argv) for (i = 1; i <= max_key + 1; i++) { stars(starstr, data[i - 1], max_value, MAX_STARS); - printf("%8ld -> %-8ld : %-8ld |%-*s|\n", + printf("%8ld -> %-8ld : %-8lld |%-*s|\n", (1l << i) >> 1, (1l << i) - 1, data[i - 1], MAX_STARS, starstr); }