Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools/resolve_btfids: Fix comparison of distinct pointer types warning in resolve_btfids

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>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/bpf/20240722083305.4009723-1-liwei.song.lsong@gmail.com

authored by

Liwei Song and committed by
Daniel Borkmann
13c9b702 0be9ae54

+1 -1
+1 -1
tools/bpf/resolve_btfids/main.c
··· 704 704 * Make sure id is at the beginning of the pairs 705 705 * struct, otherwise the below qsort would not work. 706 706 */ 707 - BUILD_BUG_ON(set8->pairs != &set8->pairs[0].id); 707 + BUILD_BUG_ON((u32 *)set8->pairs != &set8->pairs[0].id); 708 708 qsort(set8->pairs, set8->cnt, sizeof(set8->pairs[0]), cmp_id); 709 709 710 710 /*