From: Song Liu <song@kernel.org>
To: Alexander Lobakin <alobakin@pm.me>
Cc: "Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Peter Zijlstra" <peterz@infradead.org>,
"Ingo Molnar" <mingo@redhat.com>,
"Arnaldo Carvalho de Melo" <acme@kernel.org>,
"Mark Rutland" <mark.rutland@arm.com>,
"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
"Jiri Olsa" <jolsa@kernel.org>,
"Namhyung Kim" <namhyung@kernel.org>,
"Martin KaFai Lau" <kafai@fb.com>,
"Song Liu" <songliubraving@fb.com>, "Yonghong Song" <yhs@fb.com>,
"John Fastabend" <john.fastabend@gmail.com>,
"KP Singh" <kpsingh@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
"Jakub Kicinski" <kuba@kernel.org>,
"Jesper Dangaard Brouer" <hawk@kernel.org>,
"Björn Töpel" <bjorn@kernel.org>,
"Magnus Karlsson" <magnus.karlsson@intel.com>,
"Jonathan Lemon" <jonathan.lemon@gmail.com>,
"Nathan Chancellor" <nathan@kernel.org>,
"Nick Desaulniers" <ndesaulniers@google.com>,
"Dmitrii Dolgov" <9erthalion6@gmail.com>,
"Quentin Monnet" <quentin@isovalent.com>,
"Tiezhu Yang" <yangtiezhu@loongson.cn>,
"Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
"Chenbo Feng" <fengc@google.com>,
"Willem de Bruijn" <willemb@google.com>,
"Daniel Wagner" <daniel.wagner@bmw-carit.de>,
"Thomas Graf" <tgraf@suug.ch>,
"Ong Boon Leong" <boon.leong.ong@intel.com>,
linux-perf-users@vger.kernel.org,
"open list" <linux-kernel@vger.kernel.org>,
Networking <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
llvm@lists.linux.dev
Subject: Re: [PATCH bpf-next 07/11] samples: bpf: fix uin64_t format literals
Date: Fri, 15 Apr 2022 16:52:13 -0700 [thread overview]
Message-ID: <CAPhsuW7FuAKX0fJ1XPfFWWwRS+wTW0qA49V-iQVzxv4jOb47MA@mail.gmail.com> (raw)
In-Reply-To: <20220414223704.341028-8-alobakin@pm.me>
On Thu, Apr 14, 2022 at 3:46 PM Alexander Lobakin <alobakin@pm.me> wrote:
>
> There's a couple places where uin64_t is being passed as an %ld
> format argument, which is incorrect (should be %lld). Fix them.
This will cause some warning on some 64-bit compiler, no?
Song
>
> 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 <alobakin@pm.me>
> ---
> samples/bpf/cookie_uid_helper_example.c | 12 ++++++------
> samples/bpf/lwt_len_hist_user.c | 4 ++--
> 2 files changed, 8 insertions(+), 8 deletions(-)
>
> 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);
> }
> --
> 2.35.2
>
>
next prev parent reply other threads:[~2022-04-15 23:52 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-14 22:44 [PATCH bpf-next 00/11] bpf: random unpopular userspace fixes (32 bit et al.) Alexander Lobakin
2022-04-14 22:44 ` [PATCH bpf-next 01/11] bpf, perf: fix bpftool compilation with !CONFIG_PERF_EVENTS Alexander Lobakin
2022-04-15 23:07 ` Song Liu
2022-04-15 23:20 ` Song Liu
2022-04-19 9:03 ` Peter Zijlstra
2022-04-20 5:30 ` Andrii Nakryiko
2022-04-14 22:45 ` [PATCH bpf-next 02/11] bpf: always emit struct bpf_perf_link BTF Alexander Lobakin
2022-04-15 23:24 ` Song Liu
2022-04-16 17:50 ` Alexander Lobakin
2022-04-14 22:45 ` [PATCH bpf-next 03/11] tools, bpf: fix bpftool build with !CONFIG_BPF_EVENTS Alexander Lobakin
2022-04-15 23:34 ` Song Liu
2022-04-20 17:12 ` Andrii Nakryiko
2022-04-14 22:45 ` [PATCH bpf-next 04/11] samples: bpf: add 'asm/mach-generic' include path for every MIPS Alexander Lobakin
2022-04-15 23:35 ` Song Liu
2022-04-14 22:45 ` [PATCH bpf-next 05/11] samples: bpf: use host bpftool to generate vmlinux.h, not target Alexander Lobakin
2022-04-15 13:38 ` Kumar Kartikeya Dwivedi
2022-04-15 23:44 ` Song Liu
2022-04-14 22:46 ` [PATCH bpf-next 06/11] tools, bpf: fix fcntl.h include in bpftool Alexander Lobakin
2022-04-15 23:46 ` Song Liu
2022-04-14 22:46 ` [PATCH bpf-next 07/11] samples: bpf: fix uin64_t format literals Alexander Lobakin
2022-04-15 23:52 ` Song Liu [this message]
2022-04-16 17:55 ` Alexander Lobakin
2022-04-19 8:07 ` David Laight
2022-04-20 17:14 ` Andrii Nakryiko
2022-04-14 22:46 ` [PATCH bpf-next 08/11] samples: bpf: fix shifting unsigned long by 32 positions Alexander Lobakin
2022-04-15 23:54 ` Song Liu
2022-04-20 17:18 ` Andrii Nakryiko
2022-04-27 15:54 ` Yonghong Song
2022-04-27 18:53 ` Andrii Nakryiko
2022-04-14 22:46 ` [PATCH bpf-next 09/11] samples: bpf: fix include order for non-Glibc environments Alexander Lobakin
2022-04-15 23:55 ` Song Liu
2022-04-14 22:47 ` [PATCH bpf-next 10/11] samples: bpf: fix -Wsequence-point Alexander Lobakin
2022-04-15 23:56 ` Song Liu
2022-04-14 22:47 ` [PATCH bpf-next 11/11] samples: bpf: xdpsock: fix -Wmaybe-uninitialized Alexander Lobakin
2022-04-15 12:15 ` Maciej Fijalkowski
2022-04-15 23:57 ` Song Liu
2022-04-20 17:20 ` [PATCH bpf-next 00/11] bpf: random unpopular userspace fixes (32 bit et al.) Andrii Nakryiko
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=CAPhsuW7FuAKX0fJ1XPfFWWwRS+wTW0qA49V-iQVzxv4jOb47MA@mail.gmail.com \
--to=song@kernel.org \
--cc=9erthalion6@gmail.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=alobakin@pm.me \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bjorn@kernel.org \
--cc=boon.leong.ong@intel.com \
--cc=bpf@vger.kernel.org \
--cc=daniel.wagner@bmw-carit.de \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=fengc@google.com \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=jonathan.lemon@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=magnus.karlsson@intel.com \
--cc=mark.rutland@arm.com \
--cc=memxor@gmail.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=netdev@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=quentin@isovalent.com \
--cc=songliubraving@fb.com \
--cc=tgraf@suug.ch \
--cc=willemb@google.com \
--cc=yangtiezhu@loongson.cn \
--cc=yhs@fb.com \
/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;
as well as URLs for NNTP newsgroup(s).