eBPF-based security platform
gen-vmlinux-h: sort the kfuncs only when it found some
Daniel Borkmannb5314d05b489
diff --git a/tools/gen-vmlinux-h/gen-vmlinux-h.c b/tools/gen-vmlinux-h/gen-vmlinux-h.cindex 8c93a4ab..fef39d49 100644--- a/tools/gen-vmlinux-h/gen-vmlinux-h.c+++ b/tools/gen-vmlinux-h/gen-vmlinux-h.c@@ -297,7 +297,9 @@ static int dump_kfuncs(struct btf_dump *d, struct btf *btf)}}- qsort_r(kfuncs.elems, kfuncs.cnt, sizeof(*kfuncs.elems), cmp_kfuncs, btf);+ if (kfuncs.cnt)+ qsort_r(kfuncs.elems, kfuncs.cnt, sizeof(*kfuncs.elems),+ cmp_kfuncs, btf);for (i = 0; i < kfuncs.cnt; i++) {const struct btf_type *t = kfuncs.elems[i];