From mboxrd@z Thu Jan 1 00:00:00 1970 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 84B49C43217 for ; Mon, 30 May 2022 21:03:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243229AbiE3VDR (ORCPT ); Mon, 30 May 2022 17:03:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237509AbiE3VDK (ORCPT ); Mon, 30 May 2022 17:03:10 -0400 Received: from www62.your-server.de (www62.your-server.de [213.133.104.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34B77292; Mon, 30 May 2022 14:03:08 -0700 (PDT) Received: from sslproxy02.your-server.de ([78.47.166.47]) by www62.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1nvmXW-000Be0-Qm; Mon, 30 May 2022 23:03:02 +0200 Received: from [85.1.206.226] (helo=linux-2.home) by sslproxy02.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nvmXW-0009iv-CB; Mon, 30 May 2022 23:03:02 +0200 Subject: Re: [PATCH bpf-next v3 4/6] libbpf: Unify memory address casting operation style To: Pu Lehui , bpf@vger.kernel.org, linux-riscv@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Alexei Starovoitov , Andrii Nakryiko , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Luke Nelson , Xi Wang , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Paul Walmsley , Palmer Dabbelt , Albert Ou References: <20220530092815.1112406-1-pulehui@huawei.com> <20220530092815.1112406-5-pulehui@huawei.com> From: Daniel Borkmann Message-ID: Date: Mon, 30 May 2022 23:03:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20220530092815.1112406-5-pulehui@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.103.6/26557/Mon May 30 10:05:44 2022) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/30/22 11:28 AM, Pu Lehui wrote: > The members of bpf_prog_info, which are line_info, jited_line_info, > jited_ksyms and jited_func_lens, store u64 address pointed to the > corresponding memory regions. Memory addresses are conceptually > unsigned, (unsigned long) casting makes more sense, so let's make > a change for conceptual uniformity. > > Signed-off-by: Pu Lehui > --- > tools/lib/bpf/bpf_prog_linfo.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/tools/lib/bpf/bpf_prog_linfo.c b/tools/lib/bpf/bpf_prog_linfo.c > index 5c503096ef43..7beb060d0671 100644 > --- a/tools/lib/bpf/bpf_prog_linfo.c > +++ b/tools/lib/bpf/bpf_prog_linfo.c > @@ -127,7 +127,8 @@ struct bpf_prog_linfo *bpf_prog_linfo__new(const struct bpf_prog_info *info) > prog_linfo->raw_linfo = malloc(data_sz); > if (!prog_linfo->raw_linfo) > goto err_free; > - memcpy(prog_linfo->raw_linfo, (void *)(long)info->line_info, data_sz); > + memcpy(prog_linfo->raw_linfo, (void *)(unsigned long)info->line_info, > + data_sz); Took in patch 1-3, lgtm, thanks! My question around the cleanups in patch 4-6 ... there are various other such cases e.g. in libbpf, perhaps makes sense to clean all of them up at once and not just the 4 locations in here. Thanks, Daniel