From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-40131.protonmail.ch (mail-40131.protonmail.ch [185.70.40.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ACED03234 for ; Thu, 14 Apr 2022 22:46:32 +0000 (UTC) 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?Q?Bj=C3=B6rn_T=C3=B6pel?= , 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> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 m= onitoring") 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(-) diff --git a/samples/bpf/cookie_uid_helper_example.c b/samples/bpf/cookie_u= id_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) =09=09=09error(1, errno, "fail to get entry value of Key: %u\n", =09=09=09=09curN); =09=09} else { -=09=09=09printf("cookie: %u, uid: 0x%x, Packet Count: %lu," -=09=09=09=09" Bytes Count: %lu\n", curN, curEntry.uid, -=09=09=09=09curEntry.packets, curEntry.bytes); +=09=09=09printf("cookie: %u, uid: 0x%x, Packet Count: %llu, Bytes Count: %= llu\n", +=09=09=09 curN, curEntry.uid, curEntry.packets, +=09=09=09 curEntry.bytes); =09=09} =09} } @@ -265,9 +265,9 @@ static void udp_client(void) =09=09if (res < 0) =09=09=09error(1, errno, "lookup sk stat failed, cookie: %lu\n", =09=09=09 cookie); -=09=09printf("cookie: %lu, uid: 0x%x, Packet Count: %lu," -=09=09=09" Bytes Count: %lu\n\n", cookie, dataEntry.uid, -=09=09=09dataEntry.packets, dataEntry.bytes); +=09=09printf("cookie: %llu, uid: 0x%x, Packet Count: %llu, Bytes Count: %l= lu\n\n", +=09=09 cookie, dataEntry.uid, dataEntry.packets, +=09=09 dataEntry.bytes); =09} =09close(s_send); =09close(s_rcv); diff --git a/samples/bpf/lwt_len_hist_user.c b/samples/bpf/lwt_len_hist_use= r.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) =09while (bpf_map_get_next_key(map_fd, &key, &next_key) =3D=3D 0) { =09=09if (next_key >=3D MAX_INDEX) { -=09=09=09fprintf(stderr, "Key %lu out of bounds\n", next_key); +=09=09=09fprintf(stderr, "Key %llu out of bounds\n", next_key); =09=09=09continue; =09=09} @@ -66,7 +66,7 @@ int main(int argc, char **argv) =09for (i =3D 1; i <=3D max_key + 1; i++) { =09=09stars(starstr, data[i - 1], max_value, MAX_STARS); -=09=09printf("%8ld -> %-8ld : %-8ld |%-*s|\n", +=09=09printf("%8ld -> %-8ld : %-8lld |%-*s|\n", =09=09 (1l << i) >> 1, (1l << i) - 1, data[i - 1], =09=09 MAX_STARS, starstr); =09} -- 2.35.2