Received: by 2002:a19:f614:0:0:0:0:0 with SMTP id x20csp22406lfe; Fri, 15 Apr 2022 17:36:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZKAv5wvD+YsQSDuG1tTCuECNREa6qaojWRQloatxbI21xbxr0ZZ77a6Aumpg0855kiEVZ X-Received: by 2002:a63:3309:0:b0:398:1bfd:21fd with SMTP id z9-20020a633309000000b003981bfd21fdmr1122075pgz.598.1650069243997; Fri, 15 Apr 2022 17:34:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650069243; cv=none; d=google.com; s=arc-20160816; b=bNb2+x429Dhjj6aJygF+9vtAhoAcn1q4yn4QqSDLgelDh17U5EDYjyEuYUPkBxxNxs mUtQpWPgcc1UwIw+QCcBuRkDwPCW2lJx4VDZmObcum9+PeNLoxSZgUxgjsEeIG99qBRB rKV4W1pZmDKT4PuKdVQa5xQRKKtPJ+Wjc5CyP4ns2yvu6vcYeHcrYvdV5S7vagtS6cb/ y672G+sLMtrJTrW9EmqdYRudtdoeuRl+WHJnAV3uLyPU/5riLlsdhFr4LZszg1DVPyIU Q5jyH5/DVvt2BzS9aCX5mOD0pvrWkP8hVipORvLcB9EwJsDDi14uIWuR630S/jzD9eC3 L2vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=AdYPng0JtNDm1PKJuhQqUvthGHSujOiYdOqdYFZrjKY=; b=cixkF5TXDP6Af4RHGjC/bgdNVB42nHaOWlKyyM7JpBZq4sXkGbvf2WIx5LFk9L9ne0 baaSZfHHRui8GMGOVZmr1csqWEKeGVfQkF7nNjOg1nygXe9Pq0eylmHOa8osrV+Ts8k7 a0Wmrt8Kl1dxIAOHJ4+4MunXYroz4VZ5Tf14SmQxoueMH6Q78uXXkQMWtsCmKQkumHRL dcN4j0qZbf00dxT2htxeGMBhG8jSJrLZYXoE/s7mBil4EQUz+ae7Amjlq2ZWcwblF/xU ha8iBU+1tjyxCUHUrKaQg8nJDgg4z5GeaD2GaOlVgzk8kbde/yidYJPk0iWZ9jZdbOSG J0GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qNxv7R7k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id e4-20020a63f544000000b0039db95e802asi2850296pgk.666.2022.04.15.17.34.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 17:34:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qNxv7R7k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4997AE3898; Fri, 15 Apr 2022 17:30:22 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345070AbiDOXzB (ORCPT + 99 others); Fri, 15 Apr 2022 19:55:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229645AbiDOXy6 (ORCPT ); Fri, 15 Apr 2022 19:54:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 750A4954B6; Fri, 15 Apr 2022 16:52:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1B8D7B831BC; Fri, 15 Apr 2022 23:52:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B715AC385B0; Fri, 15 Apr 2022 23:52:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650066745; bh=errT7JCib6AzTkVoGPltwDcZINvMpoIAWe1b0AzmVjQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=qNxv7R7kwGBplr4pFmyq+iyauWnfSUOQxiEV1D253Qu6QckwiUPoV8kS8B7hDvkIF 8r/h9C9qoQH1xiKBFuj/MwKoZ2yrwUVOzdx0QQqGQdu6eIJ91rZ6zdZ3AFGmkUJLMx QeEhdcIHd+4kyqWYYERVkKlTGUBe8Tt33vmkE34mBM0rlflT0tTIeqCHkAPYy2m/Yi XL8JHpBzufzAHD7Lh80CX6Zg+a/JNDywq9F5odVU9gXMoiEOWmSle+Uqx/Gq0yrHeM Rzwu6FWkxKLl9ptrE4BaqBMNgBwR02nEefskx1y9zRueUrC/vgsuzK78JSe9f3Tzpm GAMzI5xhgbiwA== Received: by mail-yb1-f181.google.com with SMTP id p65so16676882ybp.9; Fri, 15 Apr 2022 16:52:25 -0700 (PDT) X-Gm-Message-State: AOAM531dF0jGOBsvuwFNiY8RNx9TS51fVO9REBpJg3c7yXIo+Nw4U4Mj gxt0cn8ndAp3aRtIEYKnrCsk2QLkQrbQ1XhSgFo= X-Received: by 2002:a25:8b81:0:b0:629:17d5:68c1 with SMTP id j1-20020a258b81000000b0062917d568c1mr1296810ybl.449.1650066744755; Fri, 15 Apr 2022 16:52:24 -0700 (PDT) MIME-Version: 1.0 References: <20220414223704.341028-1-alobakin@pm.me> <20220414223704.341028-8-alobakin@pm.me> In-Reply-To: <20220414223704.341028-8-alobakin@pm.me> From: Song Liu Date: Fri, 15 Apr 2022 16:52:13 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH bpf-next 07/11] samples: bpf: fix uin64_t format literals To: Alexander Lobakin Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , 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 , 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, open list , Networking , bpf , llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 14, 2022 at 3:46 PM Alexander Lobakin 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 > --- > 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 > >