* [PATCH] tools/resolve_btfids: fix comparison of distinct pointer types warning in resolve_btfids
@ 2024-07-22 8:32 Liwei Song
2024-07-22 8:53 ` Jiri Olsa
2024-07-22 14:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Liwei Song @ 2024-07-22 8:32 UTC (permalink / raw)
To: bpf
Cc: ast, daniel, andrii, martin.lau, eddyz87, song, yonghong.song,
john.fastabend, kpsingh, sdf, haoluo, jolsa, vmalik, alan.maguire,
friedrich.vock, dxu, linux-kernel, liwei.song.lsong
Add a type cast for set8->pairs to fix below compile warning:
main.c: In function 'sets_patch':
main.c:699:50: warning: comparison of distinct pointer types lacks a cast
699 | BUILD_BUG_ON(set8->pairs != &set8->pairs[0].id);
| ^~
Fixes: 9707ac4fe2f5 ("tools/resolve_btfids: Refactor set sorting with types from btf_ids.h")
Signed-off-by: Liwei Song <liwei.song.lsong@gmail.com>
---
tools/bpf/resolve_btfids/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c
index af393c7dee1f..b3edc239fe56 100644
--- a/tools/bpf/resolve_btfids/main.c
+++ b/tools/bpf/resolve_btfids/main.c
@@ -696,7 +696,7 @@ static int sets_patch(struct object *obj)
* Make sure id is at the beginning of the pairs
* struct, otherwise the below qsort would not work.
*/
- BUILD_BUG_ON(set8->pairs != &set8->pairs[0].id);
+ BUILD_BUG_ON((u32 *)set8->pairs != &set8->pairs[0].id);
qsort(set8->pairs, set8->cnt, sizeof(set8->pairs[0]), cmp_id);
/*
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tools/resolve_btfids: fix comparison of distinct pointer types warning in resolve_btfids
2024-07-22 8:32 [PATCH] tools/resolve_btfids: fix comparison of distinct pointer types warning in resolve_btfids Liwei Song
@ 2024-07-22 8:53 ` Jiri Olsa
2024-07-22 14:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Olsa @ 2024-07-22 8:53 UTC (permalink / raw)
To: Liwei Song
Cc: bpf, ast, daniel, andrii, martin.lau, eddyz87, song,
yonghong.song, john.fastabend, kpsingh, sdf, haoluo, vmalik,
alan.maguire, friedrich.vock, dxu, linux-kernel
On Mon, Jul 22, 2024 at 04:32:59PM +0800, Liwei Song wrote:
> Add a type cast for set8->pairs to fix below compile warning:
>
> main.c: In function 'sets_patch':
> main.c:699:50: warning: comparison of distinct pointer types lacks a cast
> 699 | BUILD_BUG_ON(set8->pairs != &set8->pairs[0].id);
> | ^~
>
> Fixes: 9707ac4fe2f5 ("tools/resolve_btfids: Refactor set sorting with types from btf_ids.h")
> Signed-off-by: Liwei Song <liwei.song.lsong@gmail.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
jirka
> ---
> tools/bpf/resolve_btfids/main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c
> index af393c7dee1f..b3edc239fe56 100644
> --- a/tools/bpf/resolve_btfids/main.c
> +++ b/tools/bpf/resolve_btfids/main.c
> @@ -696,7 +696,7 @@ static int sets_patch(struct object *obj)
> * Make sure id is at the beginning of the pairs
> * struct, otherwise the below qsort would not work.
> */
> - BUILD_BUG_ON(set8->pairs != &set8->pairs[0].id);
> + BUILD_BUG_ON((u32 *)set8->pairs != &set8->pairs[0].id);
> qsort(set8->pairs, set8->cnt, sizeof(set8->pairs[0]), cmp_id);
>
> /*
> --
> 1.8.3.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tools/resolve_btfids: fix comparison of distinct pointer types warning in resolve_btfids
2024-07-22 8:32 [PATCH] tools/resolve_btfids: fix comparison of distinct pointer types warning in resolve_btfids Liwei Song
2024-07-22 8:53 ` Jiri Olsa
@ 2024-07-22 14:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-07-22 14:40 UTC (permalink / raw)
To: Liwei Song
Cc: bpf, ast, daniel, andrii, martin.lau, eddyz87, song,
yonghong.song, john.fastabend, kpsingh, sdf, haoluo, jolsa,
vmalik, alan.maguire, friedrich.vock, dxu, linux-kernel
Hello:
This patch was applied to bpf/bpf.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:
On Mon, 22 Jul 2024 16:32:59 +0800 you wrote:
> Add a type cast for set8->pairs to fix below compile warning:
>
> main.c: In function 'sets_patch':
> main.c:699:50: warning: comparison of distinct pointer types lacks a cast
> 699 | BUILD_BUG_ON(set8->pairs != &set8->pairs[0].id);
> | ^~
>
> [...]
Here is the summary with links:
- tools/resolve_btfids: fix comparison of distinct pointer types warning in resolve_btfids
https://git.kernel.org/bpf/bpf/c/13c9b702e6cb
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-07-22 14:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-22 8:32 [PATCH] tools/resolve_btfids: fix comparison of distinct pointer types warning in resolve_btfids Liwei Song
2024-07-22 8:53 ` Jiri Olsa
2024-07-22 14:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox