Netdev List
 help / color / mirror / Atom feed
From: Yonghong Song <yhs@fb.com>
To: Andrii Nakryiko <andriin@fb.com>,
	"andrii.nakryiko@gmail.com" <andrii.nakryiko@gmail.com>,
	Alexei Starovoitov <ast@fb.com>,
	"daniel@iogearbox.net" <daniel@iogearbox.net>,
	"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Kernel Team <Kernel-team@fb.com>
Subject: Re: [PATCH bpf-next] libbpf: fix ptr to u64 conversion warning on 32-bit platforms
Date: Tue, 9 Jul 2019 04:30:15 +0000	[thread overview]
Message-ID: <b4b00fad-3f99-c36a-a510-0b281a1f2bd7@fb.com> (raw)
In-Reply-To: <20190709040007.1665882-1-andriin@fb.com>



On 7/8/19 9:00 PM, Andrii Nakryiko wrote:
> On 32-bit platforms compiler complains about conversion:
> 
> libbpf.c: In function ‘perf_event_open_probe’:
> libbpf.c:4112:17: error: cast from pointer to integer of different
> size [-Werror=pointer-to-int-cast]
>    attr.config1 = (uint64_t)(void *)name; /* kprobe_func or uprobe_path */
>                   ^
> 
> Reported-by: Matt Hart <matthew.hart@linaro.org>
> Fixes: b26500274767 ("libbpf: add kprobe/uprobe attach API")
> Tested-by: Matt Hart <matthew.hart@linaro.org>
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>

Acked-by: Yonghong Song <yhs@fb.com>

> ---
>   tools/lib/bpf/libbpf.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index ed07789b3e62..794dd5064ae8 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -4126,8 +4126,8 @@ static int perf_event_open_probe(bool uprobe, bool retprobe, const char *name,
>   	}
>   	attr.size = sizeof(attr);
>   	attr.type = type;
> -	attr.config1 = (uint64_t)(void *)name; /* kprobe_func or uprobe_path */
> -	attr.config2 = offset;		       /* kprobe_addr or probe_offset */
> +	attr.config1 = ptr_to_u64(name); /* kprobe_func or uprobe_path */
> +	attr.config2 = offset;		 /* kprobe_addr or probe_offset */
>   
>   	/* pid filter is meaningful only for uprobes */
>   	pfd = syscall(__NR_perf_event_open, &attr,
> 

  reply	other threads:[~2019-07-09  4:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-09  4:00 [PATCH bpf-next] libbpf: fix ptr to u64 conversion warning on 32-bit platforms Andrii Nakryiko
2019-07-09  4:30 ` Yonghong Song [this message]
2019-07-12 12:56   ` Matt Hart
2019-07-12 13:06     ` Daniel Borkmann

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=b4b00fad-3f99-c36a-a510-0b281a1f2bd7@fb.com \
    --to=yhs@fb.com \
    --cc=Kernel-team@fb.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andriin@fb.com \
    --cc=ast@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=netdev@vger.kernel.org \
    /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