Re: [PATCH bpf-next v3 4/6] libbpf: Unify memory address casting operation style

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2022/5/31 5:03, Daniel Borkmann wrote:
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 <pulehui@xxxxxxxxxx>
---
  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.


sorry for reply so late, I will take this soon.

Thanks,
Daniel
.



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux