bpftool: Check for NULL ptr of btf in codegen_asserts
[linux-2.6-microblaze.git] / tools / bpf / bpftool / gen.c
index 4c9477f..f158dc1 100644 (file)
@@ -474,6 +474,9 @@ static void codegen_asserts(struct bpf_object *obj, const char *obj_name)
        const struct btf_type *sec;
        char map_ident[256], var_ident[256];
 
+       if (!btf)
+               return;
+
        codegen("\
                \n\
                __attribute__((unused)) static void                         \n\