libbpf-1.6.2-1.fc44

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-122): [#def1]
libbpf-1.6.2/src/bpf_prog_linfo.c:79:9: warning[-Wanalyzer-out-of-bounds]: heap-based buffer overflow
libbpf-1.6.2/src/bpf_prog_linfo.c:100:24: enter_function: entry to ‘bpf_prog_linfo__new’
libbpf-1.6.2/src/bpf_prog_linfo.c:108:12: branch_false: following ‘false’ branch (when ‘nr_linfo != 0’)...
libbpf-1.6.2/src/bpf_prog_linfo.c:115:13: branch_false: ...to here
libbpf-1.6.2/src/bpf_prog_linfo.c:115:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/bpf_prog_linfo.c:119:22: branch_false: ...to here
libbpf-1.6.2/src/bpf_prog_linfo.c:120:12: branch_false: following ‘false’ branch (when ‘prog_linfo’ is non-NULL)...
libbpf-1.6.2/src/bpf_prog_linfo.c:124:9: branch_false: ...to here
libbpf-1.6.2/src/bpf_prog_linfo.c:128:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/bpf_prog_linfo.c:130:53: branch_false: ...to here
libbpf-1.6.2/src/bpf_prog_linfo.c:133:12: branch_false: following ‘false’ branch (when ‘nr_jited_func != 0’)...
libbpf-1.6.2/src/bpf_prog_linfo.c:134:14: branch_false: ...to here
libbpf-1.6.2/src/bpf_prog_linfo.c:133:13: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/bpf_prog_linfo.c:135:13: branch_false: ...to here
libbpf-1.6.2/src/bpf_prog_linfo.c:133:13: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/bpf_prog_linfo.c:136:13: branch_false: ...to here
libbpf-1.6.2/src/bpf_prog_linfo.c:133:13: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/bpf_prog_linfo.c:137:13: branch_false: ...to here
libbpf-1.6.2/src/bpf_prog_linfo.c:133:13: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/bpf_prog_linfo.c:138:14: branch_false: ...to here
libbpf-1.6.2/src/bpf_prog_linfo.c:133:13: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/bpf_prog_linfo.c:139:14: branch_false: ...to here
libbpf-1.6.2/src/bpf_prog_linfo.c:133:13: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/bpf_prog_linfo.c:144:9: branch_false: ...to here
libbpf-1.6.2/src/bpf_prog_linfo.c:148:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/bpf_prog_linfo.c:150:9: branch_false: ...to here
libbpf-1.6.2/src/bpf_prog_linfo.c:156:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/bpf_prog_linfo.c:163:44: branch_false: ...to here
libbpf-1.6.2/src/bpf_prog_linfo.c:165:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/bpf_prog_linfo.c:168:13: branch_false: ...to here
libbpf-1.6.2/src/bpf_prog_linfo.c:168:13: call_function: calling ‘dissect_jited_func’ from ‘bpf_prog_linfo__new’
#   77|   		goto errout;
#   78|   
#   79|-> 	prog_linfo->nr_jited_linfo_per_func[nr_jited_func - 1] =
#   80|   		nr_linfo - prev_i;
#   81|   

Error: CPPCHECK_WARNING (CWE-457): [#def2]
libbpf-1.6.2/src/btf.c:1874: error[uninitvar]: Uninitialized variable: mapped_off
# 1872|   	if (p->str_off_map &&
# 1873|   	    hashmap__find(p->str_off_map, *str_off, &mapped_off)) {
# 1874|-> 		*str_off = mapped_off;
# 1875|   		return 0;
# 1876|   	}

Error: CPPCHECK_WARNING (CWE-457): [#def3]
libbpf-1.6.2/src/btf.c:5163: error[uninitvar]: Uninitialized variable: cand_id
# 5161|   
# 5162|   	/* Zero is a special value indicating that name is not unique */
# 5163|-> 	if (!cand_id)
# 5164|   		return 0;
# 5165|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
libbpf-1.6.2/src/btf_relocate.c:202:26: warning[-Wanalyzer-malloc-leak]: leak of ‘info’
libbpf-1.6.2/src/btf_relocate.c:195:16: acquire_memory: allocated here
libbpf-1.6.2/src/btf_relocate.c:196:12: branch_false: following ‘false’ branch (when ‘info’ is non-NULL)...
libbpf-1.6.2/src/btf_relocate.c:200:25: branch_false: ...to here
libbpf-1.6.2/src/btf_relocate.c:201:22: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/btf_relocate.c:202:26: branch_true: ...to here
libbpf-1.6.2/src/btf_relocate.c:202:26: danger: ‘info’ leaks here; was allocated at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  200|   	info_end = info + r->nr_dist_base_types;
#  201|   	for (id = 0; id < r->nr_dist_base_types; id++) {
#  202|-> 		dist_t = btf_type_by_id(r->dist_base_btf, id);
#  203|   		info[id].name = btf__name_by_offset(r->dist_base_btf, dist_t->name_off);
#  204|   		info[id].id = id;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def5]
libbpf-1.6.2/src/btf_relocate.c:203:33: warning[-Wanalyzer-malloc-leak]: leak of ‘info’
libbpf-1.6.2/src/btf_relocate.c:195:16: acquire_memory: allocated here
libbpf-1.6.2/src/btf_relocate.c:196:12: branch_false: following ‘false’ branch (when ‘info’ is non-NULL)...
libbpf-1.6.2/src/btf_relocate.c:200:25: branch_false: ...to here
libbpf-1.6.2/src/btf_relocate.c:201:22: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/btf_relocate.c:202:26: branch_true: ...to here
libbpf-1.6.2/src/btf_relocate.c:203:33: danger: ‘info’ leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  201|   	for (id = 0; id < r->nr_dist_base_types; id++) {
#  202|   		dist_t = btf_type_by_id(r->dist_base_btf, id);
#  203|-> 		info[id].name = btf__name_by_offset(r->dist_base_btf, dist_t->name_off);
#  204|   		info[id].id = id;
#  205|   		info[id].size = dist_t->size;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def6]
libbpf-1.6.2/src/btf_relocate.c:208:9: warning[-Wanalyzer-malloc-leak]: leak of ‘info’
libbpf-1.6.2/src/btf_relocate.c:195:16: acquire_memory: allocated here
libbpf-1.6.2/src/btf_relocate.c:196:12: branch_false: following ‘false’ branch (when ‘info’ is non-NULL)...
libbpf-1.6.2/src/btf_relocate.c:200:25: branch_false: ...to here
libbpf-1.6.2/src/btf_relocate.c:201:22: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:208:9: branch_false: ...to here
libbpf-1.6.2/src/btf_relocate.c:208:9: danger: ‘info’ leaks here; was allocated at [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#  206|   		info[id].needs_size = true;
#  207|   	}
#  208|-> 	qsort(info, r->nr_dist_base_types, sizeof(*info), cmp_btf_name_size);
#  209|   
#  210|   	/* Mark distilled base struct/union members of split BTF structs/unions

Error: GCC_ANALYZER_WARNING (CWE-401): [#def7]
libbpf-1.6.2/src/btf_relocate.c:231:26: warning[-Wanalyzer-malloc-leak]: leak of ‘base_name_cnt’
libbpf-1.6.2/src/btf_relocate.c:196:12: branch_false: following ‘false’ branch (when ‘info’ is non-NULL)...
libbpf-1.6.2/src/btf_relocate.c:200:25: branch_false: ...to here
libbpf-1.6.2/src/btf_relocate.c:215:42: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:225:32: branch_false: ...to here
libbpf-1.6.2/src/btf_relocate.c:225:25: acquire_memory: allocated here
libbpf-1.6.2/src/btf_relocate.c:226:12: branch_false: following ‘false’ branch (when ‘base_name_cnt’ is non-NULL)...
 branch_false: ...to here
libbpf-1.6.2/src/btf_relocate.c:230:22: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/btf_relocate.c:231:26: branch_true: ...to here
libbpf-1.6.2/src/btf_relocate.c:231:26: danger: ‘base_name_cnt’ leaks here; was allocated at [(5)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/4)
#  229|   	}
#  230|   	for (id = 1; id < r->nr_base_types; id++) {
#  231|-> 		base_t = btf_type_by_id(r->base_btf, id);
#  232|   		if (!btf_is_composite(base_t) || !base_t->name_off)
#  233|   			continue;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def8]
libbpf-1.6.2/src/btf_relocate.c:243:26: warning[-Wanalyzer-malloc-leak]: leak of ‘base_name_cnt’
libbpf-1.6.2/src/btf_relocate.c:196:12: branch_false: following ‘false’ branch (when ‘info’ is non-NULL)...
libbpf-1.6.2/src/btf_relocate.c:200:25: branch_false: ...to here
libbpf-1.6.2/src/btf_relocate.c:215:42: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:225:32: branch_false: ...to here
libbpf-1.6.2/src/btf_relocate.c:225:25: acquire_memory: allocated here
libbpf-1.6.2/src/btf_relocate.c:226:12: branch_false: following ‘false’ branch (when ‘base_name_cnt’ is non-NULL)...
 branch_false: ...to here
libbpf-1.6.2/src/btf_relocate.c:230:22: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/btf_relocate.c:231:26: branch_true: ...to here
libbpf-1.6.2/src/btf_relocate.c:239:22: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/btf_relocate.c:240:50: branch_true: ...to here
libbpf-1.6.2/src/btf_relocate.c:243:26: danger: ‘base_name_cnt’ leaks here; was allocated at [(5)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/4)
#  241|   		int dist_kind, base_kind;
#  242|   
#  243|-> 		base_t = btf_type_by_id(r->base_btf, id);
#  244|   		/* distilled base consists of named types only. */
#  245|   		if (!base_t->name_off)

Error: GCC_ANALYZER_WARNING (CWE-401): [#def9]
libbpf-1.6.2/src/btf_relocate.c:249:34: warning[-Wanalyzer-malloc-leak]: leak of ‘base_name_cnt’
libbpf-1.6.2/src/btf_relocate.c:184:12: enter_function: entry to ‘btf_relocate_map_distilled_base’
libbpf-1.6.2/src/btf_relocate.c:196:12: branch_false: following ‘false’ branch (when ‘info’ is non-NULL)...
libbpf-1.6.2/src/btf_relocate.c:200:25: branch_false: ...to here
libbpf-1.6.2/src/btf_relocate.c:215:42: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:225:32: branch_false: ...to here
libbpf-1.6.2/src/btf_relocate.c:225:25: acquire_memory: allocated here
libbpf-1.6.2/src/btf_relocate.c:226:12: branch_false: following ‘false’ branch (when ‘base_name_cnt’ is non-NULL)...
 branch_false: ...to here
libbpf-1.6.2/src/btf_relocate.c:230:22: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/btf_relocate.c:231:26: branch_true: ...to here
libbpf-1.6.2/src/btf_relocate.c:239:22: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/btf_relocate.c:240:50: branch_true: ...to here
libbpf-1.6.2/src/btf_relocate.c:245:20: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:247:29: call_function: inlined call to ‘btf_kind’ from ‘btf_relocate_map_distilled_base’
libbpf-1.6.2/src/btf_relocate.c:249:34: danger: ‘base_name_cnt’ leaks here; was allocated at [(6)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/5)
#  247|   		base_kind = btf_kind(base_t);
#  248|   		base_info.id = id;
#  249|-> 		base_info.name = btf__name_by_offset(r->base_btf, base_t->name_off);
#  250|   		switch (base_kind) {
#  251|   		case BTF_KIND_INT:

Error: GCC_ANALYZER_WARNING (CWE-401): [#def10]
libbpf-1.6.2/src/btf_relocate.c:283:33: warning[-Wanalyzer-malloc-leak]: leak of ‘base_name_cnt’
libbpf-1.6.2/src/btf_relocate.c:444:5: enter_function: entry to ‘btf_relocate’
libbpf-1.6.2/src/btf_relocate.c:454:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:469:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:475:12: branch_false: following ‘false’ branch...
 branch_false: ...to here
libbpf-1.6.2/src/btf_relocate.c:482:41: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/btf_relocate.c:483:32: branch_true: ...to here
libbpf-1.6.2/src/btf_relocate.c:482:41: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/btf_relocate.c:483:32: branch_true: ...to here
libbpf-1.6.2/src/btf_relocate.c:482:41: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/btf_relocate.c:483:32: branch_true: ...to here
libbpf-1.6.2/src/btf_relocate.c:489:15: call_function: calling ‘btf_relocate_map_distilled_base’ from ‘btf_relocate’
#  281|   		     dist_info++) {
#  282|   			if (!dist_info->id || dist_info->id >= r->nr_dist_base_types) {
#  283|-> 				pr_warn("base BTF id [%d] maps to invalid distilled base BTF id [%d]\n",
#  284|   					id, dist_info->id);
#  285|   				err = -EINVAL;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def11]
libbpf-1.6.2/src/btf_relocate.c:288:34: warning[-Wanalyzer-malloc-leak]: leak of ‘base_name_cnt’
libbpf-1.6.2/src/btf_relocate.c:444:5: enter_function: entry to ‘btf_relocate’
libbpf-1.6.2/src/btf_relocate.c:454:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:469:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:475:12: branch_false: following ‘false’ branch...
 branch_false: ...to here
libbpf-1.6.2/src/btf_relocate.c:482:41: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/btf_relocate.c:483:32: branch_true: ...to here
libbpf-1.6.2/src/btf_relocate.c:482:41: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/btf_relocate.c:483:32: branch_true: ...to here
libbpf-1.6.2/src/btf_relocate.c:482:41: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/btf_relocate.c:483:32: branch_true: ...to here
libbpf-1.6.2/src/btf_relocate.c:489:15: call_function: calling ‘btf_relocate_map_distilled_base’ from ‘btf_relocate’
#  286|   				goto done;
#  287|   			}
#  288|-> 			dist_t = btf_type_by_id(r->dist_base_btf, dist_info->id);
#  289|   			dist_kind = btf_kind(dist_t);
#  290|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def12]
libbpf-1.6.2/src/btf_relocate.c:352:33: warning[-Wanalyzer-malloc-leak]: leak of ‘base_name_cnt’
libbpf-1.6.2/src/btf_relocate.c:444:5: enter_function: entry to ‘btf_relocate’
libbpf-1.6.2/src/btf_relocate.c:454:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:469:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:475:12: branch_false: following ‘false’ branch...
 branch_false: ...to here
libbpf-1.6.2/src/btf_relocate.c:482:41: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/btf_relocate.c:483:32: branch_true: ...to here
libbpf-1.6.2/src/btf_relocate.c:482:41: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/btf_relocate.c:483:32: branch_true: ...to here
libbpf-1.6.2/src/btf_relocate.c:482:41: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/btf_relocate.c:483:32: branch_true: ...to here
libbpf-1.6.2/src/btf_relocate.c:489:15: call_function: calling ‘btf_relocate_map_distilled_base’ from ‘btf_relocate’
#  350|   				 * to in base BTF, so error out.
#  351|   				 */
#  352|-> 				pr_warn("distilled base BTF type '%s' [%u], size %u has multiple candidates of the same size (ids [%u, %u]) in base BTF\n",
#  353|   					base_info.name, dist_info->id,
#  354|   					base_t->size, id, r->id_map[dist_info->id]);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def13]
libbpf-1.6.2/src/btf_relocate.c:388:38: warning[-Wanalyzer-malloc-leak]: leak of ‘r.id_map’
libbpf-1.6.2/src/btf_relocate.c:444:5: enter_function: entry to ‘btf_relocate’
libbpf-1.6.2/src/btf_relocate.c:454:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:463:20: acquire_memory: allocated here
libbpf-1.6.2/src/btf_relocate.c:469:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:474:15: call_function: calling ‘btf_relocate_validate_distilled_base’ from ‘btf_relocate’
#  386|   
#  387|   	for (i = 1; i < r->nr_dist_base_types; i++) {
#  388|-> 		struct btf_type *t = btf_type_by_id(r->dist_base_btf, i);
#  389|   		int kind = btf_kind(t);
#  390|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def14]
libbpf-1.6.2/src/btf_relocate.c:388:38: warning[-Wanalyzer-malloc-leak]: leak of ‘r.str_map’
libbpf-1.6.2/src/btf_relocate.c:444:5: enter_function: entry to ‘btf_relocate’
libbpf-1.6.2/src/btf_relocate.c:454:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:464:21: acquire_memory: allocated here
libbpf-1.6.2/src/btf_relocate.c:469:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:469:13: branch_false: ...to here
libbpf-1.6.2/src/btf_relocate.c:469:13: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:474:15: branch_false: ...to here
libbpf-1.6.2/src/btf_relocate.c:474:15: call_function: calling ‘btf_relocate_validate_distilled_base’ from ‘btf_relocate’
#  386|   
#  387|   	for (i = 1; i < r->nr_dist_base_types; i++) {
#  388|-> 		struct btf_type *t = btf_type_by_id(r->dist_base_btf, i);
#  389|   		int kind = btf_kind(t);
#  390|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def15]
libbpf-1.6.2/src/btf_relocate.c:400:25: warning[-Wanalyzer-malloc-leak]: leak of ‘r.id_map’
libbpf-1.6.2/src/btf_relocate.c:444:5: enter_function: entry to ‘btf_relocate’
libbpf-1.6.2/src/btf_relocate.c:454:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:463:20: acquire_memory: allocated here
libbpf-1.6.2/src/btf_relocate.c:469:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:474:15: call_function: calling ‘btf_relocate_validate_distilled_base’ from ‘btf_relocate’
#  398|   			if (t->name_off)
#  399|   				break;
#  400|-> 			pr_warn("type [%d], kind [%d] is invalid for distilled base BTF; it is anonymous\n",
#  401|   				i, kind);
#  402|   			return -EINVAL;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def16]
libbpf-1.6.2/src/btf_relocate.c:400:25: warning[-Wanalyzer-malloc-leak]: leak of ‘r.str_map’
libbpf-1.6.2/src/btf_relocate.c:444:5: enter_function: entry to ‘btf_relocate’
libbpf-1.6.2/src/btf_relocate.c:454:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:464:21: acquire_memory: allocated here
libbpf-1.6.2/src/btf_relocate.c:469:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:469:13: branch_false: ...to here
libbpf-1.6.2/src/btf_relocate.c:469:13: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:474:15: branch_false: ...to here
libbpf-1.6.2/src/btf_relocate.c:474:15: call_function: calling ‘btf_relocate_validate_distilled_base’ from ‘btf_relocate’
#  398|   			if (t->name_off)
#  399|   				break;
#  400|-> 			pr_warn("type [%d], kind [%d] is invalid for distilled base BTF; it is anonymous\n",
#  401|   				i, kind);
#  402|   			return -EINVAL;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def17]
libbpf-1.6.2/src/btf_relocate.c:404:25: warning[-Wanalyzer-malloc-leak]: leak of ‘r.id_map’
libbpf-1.6.2/src/btf_relocate.c:444:5: enter_function: entry to ‘btf_relocate’
libbpf-1.6.2/src/btf_relocate.c:454:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:463:20: acquire_memory: allocated here
libbpf-1.6.2/src/btf_relocate.c:469:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:474:15: call_function: calling ‘btf_relocate_validate_distilled_base’ from ‘btf_relocate’
#  402|   			return -EINVAL;
#  403|   		default:
#  404|-> 			pr_warn("type [%d] in distilled based BTF has unexpected kind [%d]\n",
#  405|   				i, kind);
#  406|   			return -EINVAL;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def18]
libbpf-1.6.2/src/btf_relocate.c:404:25: warning[-Wanalyzer-malloc-leak]: leak of ‘r.str_map’
libbpf-1.6.2/src/btf_relocate.c:444:5: enter_function: entry to ‘btf_relocate’
libbpf-1.6.2/src/btf_relocate.c:454:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:464:21: acquire_memory: allocated here
libbpf-1.6.2/src/btf_relocate.c:469:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:469:13: branch_false: ...to here
libbpf-1.6.2/src/btf_relocate.c:469:13: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:474:15: branch_false: ...to here
libbpf-1.6.2/src/btf_relocate.c:474:15: call_function: calling ‘btf_relocate_validate_distilled_base’ from ‘btf_relocate’
#  402|   			return -EINVAL;
#  403|   		default:
#  404|-> 			pr_warn("type [%d] in distilled based BTF has unexpected kind [%d]\n",
#  405|   				i, kind);
#  406|   			return -EINVAL;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def19]
libbpf-1.6.2/src/btf_relocate.c:464:28: warning[-Wanalyzer-malloc-leak]: leak of ‘r.id_map’
libbpf-1.6.2/src/btf_relocate.c:454:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:463:20: acquire_memory: allocated here
libbpf-1.6.2/src/btf_relocate.c:464:28: danger: ‘r.id_map’ leaks here; was allocated at [(3)](sarif:/runs/0/results/15/codeFlows/0/threadFlows/0/locations/2)
#  462|   
#  463|   	r.id_map = calloc(nr_types, sizeof(*r.id_map));
#  464|-> 	r.str_map = calloc(btf_header(r.dist_base_btf)->str_len, sizeof(*r.str_map));
#  465|   	dist_base_hdr = btf_header(r.dist_base_btf);
#  466|   	base_hdr = btf_header(r.base_btf);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def20]
libbpf-1.6.2/src/btf_relocate.c:465:25: warning[-Wanalyzer-malloc-leak]: leak of ‘r.id_map’
libbpf-1.6.2/src/btf_relocate.c:454:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:463:20: acquire_memory: allocated here
libbpf-1.6.2/src/btf_relocate.c:465:25: danger: ‘r.id_map’ leaks here; was allocated at [(3)](sarif:/runs/0/results/17/codeFlows/0/threadFlows/0/locations/2)
#  463|   	r.id_map = calloc(nr_types, sizeof(*r.id_map));
#  464|   	r.str_map = calloc(btf_header(r.dist_base_btf)->str_len, sizeof(*r.str_map));
#  465|-> 	dist_base_hdr = btf_header(r.dist_base_btf);
#  466|   	base_hdr = btf_header(r.base_btf);
#  467|   	r.dist_str_len = dist_base_hdr->str_len;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def21]
libbpf-1.6.2/src/btf_relocate.c:465:25: warning[-Wanalyzer-malloc-leak]: leak of ‘r.str_map’
libbpf-1.6.2/src/btf_relocate.c:454:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:464:21: acquire_memory: allocated here
libbpf-1.6.2/src/btf_relocate.c:465:25: danger: ‘r.str_map’ leaks here; was allocated at [(3)](sarif:/runs/0/results/16/codeFlows/0/threadFlows/0/locations/2)
#  463|   	r.id_map = calloc(nr_types, sizeof(*r.id_map));
#  464|   	r.str_map = calloc(btf_header(r.dist_base_btf)->str_len, sizeof(*r.str_map));
#  465|-> 	dist_base_hdr = btf_header(r.dist_base_btf);
#  466|   	base_hdr = btf_header(r.base_btf);
#  467|   	r.dist_str_len = dist_base_hdr->str_len;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def22]
libbpf-1.6.2/src/btf_relocate.c:466:20: warning[-Wanalyzer-malloc-leak]: leak of ‘r.id_map’
libbpf-1.6.2/src/btf_relocate.c:454:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:463:20: acquire_memory: allocated here
libbpf-1.6.2/src/btf_relocate.c:466:20: danger: ‘r.id_map’ leaks here; was allocated at [(3)](sarif:/runs/0/results/18/codeFlows/0/threadFlows/0/locations/2)
#  464|   	r.str_map = calloc(btf_header(r.dist_base_btf)->str_len, sizeof(*r.str_map));
#  465|   	dist_base_hdr = btf_header(r.dist_base_btf);
#  466|-> 	base_hdr = btf_header(r.base_btf);
#  467|   	r.dist_str_len = dist_base_hdr->str_len;
#  468|   	r.base_str_len = base_hdr->str_len;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def23]
libbpf-1.6.2/src/btf_relocate.c:466:20: warning[-Wanalyzer-malloc-leak]: leak of ‘r.str_map’
libbpf-1.6.2/src/btf_relocate.c:454:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/btf_relocate.c:464:21: acquire_memory: allocated here
libbpf-1.6.2/src/btf_relocate.c:466:20: danger: ‘r.str_map’ leaks here; was allocated at [(3)](sarif:/runs/0/results/19/codeFlows/0/threadFlows/0/locations/2)
#  464|   	r.str_map = calloc(btf_header(r.dist_base_btf)->str_len, sizeof(*r.str_map));
#  465|   	dist_base_hdr = btf_header(r.dist_base_btf);
#  466|-> 	base_hdr = btf_header(r.base_btf);
#  467|   	r.dist_str_len = dist_base_hdr->str_len;
#  468|   	r.base_str_len = base_hdr->str_len;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def24]
libbpf-1.6.2/src/elf.c:43:15: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(binary_path, 524288)’
libbpf-1.6.2/src/elf.c:33:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/elf.c:37:14: branch_false: ...to here
libbpf-1.6.2/src/elf.c:37:14: acquire_resource: opened here
libbpf-1.6.2/src/elf.c:38:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/elf.c:43:15: branch_false: ...to here
libbpf-1.6.2/src/elf.c:43:15: danger: ‘open(binary_path, 524288)’ leaks here; was opened at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#   41|   		return ret;
#   42|   	}
#   43|-> 	elf = elf_begin(fd, ELF_C_READ_MMAP, NULL);
#   44|   	if (!elf) {
#   45|   		pr_warn("elf: could not read elf from %s: %s\n", binary_path, elf_errmsg(-1));

Error: CPPCHECK_WARNING (CWE-457): [#def25]
libbpf-1.6.2/src/features.c:321: error[uninitvar]: Uninitialized variable: name
#  319|   
#  320|   	memset(&info, 0, sizeof(info));
#  321|-> 	info.name = ptr_to_u64(name);
#  322|   	info.name_len = sizeof(name);
#  323|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def26]
libbpf-1.6.2/src/hashmap.c:118:21: warning[-Wanalyzer-malloc-leak]: leak of ‘new_buckets’
libbpf-1.6.2/src/hashmap.c:113:23: acquire_memory: allocated here
libbpf-1.6.2/src/hashmap.c:114:12: branch_false: following ‘false’ branch (when ‘new_buckets’ is non-NULL)...
 branch_false: ...to here
libbpf-1.6.2/src/hashmap.c:117:9: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/hashmap.c:118:21: danger: ‘new_buckets’ leaks here; was allocated at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  116|   
#  117|   	hashmap__for_each_entry_safe(map, cur, tmp, bkt) {
#  118|-> 		h = hash_bits(map->hash_fn(cur->key, map->ctx), new_cap_bits);
#  119|   		hashmap_add_entry(&new_buckets[h], cur);
#  120|   	}

Error: CPPCHECK_WARNING (CWE-758): [#def27]
libbpf-1.6.2/src/libbpf_internal.h:249: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
#  247|   static inline __u32 btf_type_info(int kind, int vlen, int kflag)
#  248|   {
#  249|-> 	return (kflag << 31) | (kind << 24) | vlen;
#  250|   }
#  251|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def28]
libbpf-1.6.2/src/libbpf_probes.c:249:18: warning[-Wanalyzer-malloc-leak]: leak of ‘raw_btf’
libbpf-1.6.2/src/libbpf_probes.c:241:19: acquire_memory: allocated here
libbpf-1.6.2/src/libbpf_probes.c:242:12: branch_false: following ‘false’ branch (when ‘raw_btf’ is non-NULL)...
libbpf-1.6.2/src/libbpf_probes.c:245:9: branch_false: ...to here
libbpf-1.6.2/src/libbpf_probes.c:249:18: danger: ‘raw_btf’ leaks here; was allocated at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  247|   	memcpy(raw_btf + hdr.hdr_len + hdr.type_len, str_sec, hdr.str_len);
#  248|   
#  249|-> 	btf_fd = bpf_btf_load(raw_btf, btf_len, &opts);
#  250|   
#  251|   	free(raw_btf);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def29]
libbpf-1.6.2/src/linker.c:350:9: warning[-Wanalyzer-malloc-leak]: leak of ‘realloc(*symtab.raw_data,  __real__ <unknown>)’
libbpf-1.6.2/src/linker.c:1996:12: enter_function: entry to ‘linker_append_elf_sym’
libbpf-1.6.2/src/linker.c:2018:19: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/linker.c:2031:12: branch_false: ...to here
libbpf-1.6.2/src/linker.c:2031:12: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/linker.c:2032:17: branch_true: ...to here
libbpf-1.6.2/src/linker.c:2150:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/linker.c:2153:19: branch_false: ...to here
libbpf-1.6.2/src/linker.c:2153:19: call_function: calling ‘add_new_sym’ from ‘linker_append_elf_sym’
#  348|   
#  349|   	symtab->raw_data = syms;
#  350|-> 	symtab->sec_sz += sizeof(*sym);
#  351|   	symtab->shdr->sh_size += sizeof(*sym);
#  352|   	symtab->data->d_size += sizeof(*sym);

Error: CPPCHECK_WARNING (CWE-476): [#def30]
libbpf-1.6.2/src/linker.c:1687: error[ctunullpointer]: Null pointer dereference: extra_def
# 1685|   	const char *reason;
# 1686|   
# 1687|-> 	if (main_def->map_type != extra_def->map_type) {
# 1688|   		reason = "type";
# 1689|   		goto mismatch;

Error: CPPCHECK_WARNING (CWE-476): [#def31]
libbpf-1.6.2/src/linker.c:1687: error[ctunullpointer]: Null pointer dereference: main_def
# 1685|   	const char *reason;
# 1686|   
# 1687|-> 	if (main_def->map_type != extra_def->map_type) {
# 1688|   		reason = "type";
# 1689|   		goto mismatch;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def32]
libbpf-1.6.2/src/linker.c:2555:37: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
libbpf-1.6.2/src/linker.c:2410:12: enter_function: entry to ‘linker_append_btf’
libbpf-1.6.2/src/linker.c:2416:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/linker.c:2419:34: branch_false: ...to here
libbpf-1.6.2/src/linker.c:2423:12: branch_false: following ‘false’ branch...
 branch_false: ...to here
libbpf-1.6.2/src/linker.c:2522:21: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/linker.c:2528:28: branch_true: ...to here
libbpf-1.6.2/src/linker.c:2529:20: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/linker.c:2546:29: branch_true: following ‘true’ branch (when ‘j < n’)...
libbpf-1.6.2/src/linker.c:2547:31: branch_true: ...to here
libbpf-1.6.2/src/linker.c:2552:28: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/linker.c:2553:72: branch_true: ...to here
libbpf-1.6.2/src/linker.c:2554:44: call_function: calling ‘find_glob_sym’ from ‘linker_append_btf’
libbpf-1.6.2/src/linker.c:2554:44: return_function: returning to ‘linker_append_btf’ from ‘find_glob_sym’
libbpf-1.6.2/src/linker.c:2555:37: danger: dereference of NULL ‘find_glob_sym(linker,  btf__str_by_offset(*linker.btf, *<unknown>.name_off))’
# 2553|   				name = btf__str_by_offset(linker->btf, t->name_off);
# 2554|   				glob_sym = find_glob_sym(linker, name);
# 2555|-> 				if (glob_sym->sec_id != dst_sec->id) {
# 2556|   					pr_warn("global '%s': section mismatch %d vs %d\n",
# 2557|   						name, glob_sym->sec_id, dst_sec->id);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def33]
libbpf-1.6.2/src/linker.c:2950:19: warning[-Wanalyzer-malloc-leak]: leak of ‘data’
libbpf-1.6.2/src/linker.c:2966:12: enter_function: entry to ‘finalize_btf_ext’
libbpf-1.6.2/src/linker.c:2978:21: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/linker.c:2979:40: branch_true: ...to here
libbpf-1.6.2/src/linker.c:2981:20: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/linker.c:2982:28: branch_true: ...to here
libbpf-1.6.2/src/linker.c:2982:28: branch_true: following ‘true’ branch (when ‘func_rec_sz == 0’)...
libbpf-1.6.2/src/linker.c:2983:47: branch_true: ...to here
libbpf-1.6.2/src/linker.c:2984:28: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/linker.c:2990:71: branch_false: ...to here
libbpf-1.6.2/src/linker.c:2992:20: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/linker.c:3003:21: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3003:20: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/linker.c:2978:42: branch_false: ...to here
libbpf-1.6.2/src/linker.c:2978:21: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/linker.c:3016:13: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3016:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/linker.c:3020:12: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3024:12: branch_false: following ‘false’ branch (when ‘lines_sz == 0’)...
libbpf-1.6.2/src/linker.c:3028:12: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3028:12: branch_false: following ‘false’ branch (when ‘core_relos_sz == 0’)...
libbpf-1.6.2/src/linker.c:3033:22: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3033:22: acquire_memory: allocated here
libbpf-1.6.2/src/linker.c:3034:12: branch_false: following ‘false’ branch (when ‘data’ is non-NULL)...
libbpf-1.6.2/src/linker.c:3038:9: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3052:12: branch_true: following ‘true’ branch (when ‘funcs_sz != 0’)...
libbpf-1.6.2/src/linker.c:3053:17: branch_true: ...to here
libbpf-1.6.2/src/linker.c:3056:29: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/linker.c:3057:48: branch_true: ...to here
libbpf-1.6.2/src/linker.c:3059:30: call_function: inlined call to ‘emit_btf_ext_data’ from ‘finalize_btf_ext’
 branch_false: ...to here
libbpf-1.6.2/src/linker.c:3059:30: call_function: inlined call to ‘emit_btf_ext_data’ from ‘finalize_btf_ext’
# 2948|   		return 0;
# 2949|   
# 2950|-> 	str_off = btf__add_str(linker->btf, sec_name);
# 2951|   	if (str_off < 0)
# 2952|   		return -ENOMEM;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def34]
libbpf-1.6.2/src/linker.c:3103:27: warning[-Wanalyzer-malloc-leak]: leak of ‘data’
libbpf-1.6.2/src/linker.c:2978:21: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/linker.c:2979:40: branch_true: ...to here
libbpf-1.6.2/src/linker.c:2981:20: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/linker.c:2992:21: branch_false: ...to here
libbpf-1.6.2/src/linker.c:2992:20: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/linker.c:2993:28: branch_true: ...to here
libbpf-1.6.2/src/linker.c:2993:28: branch_true: following ‘true’ branch (when ‘line_rec_sz == 0’)...
libbpf-1.6.2/src/linker.c:2994:47: branch_true: ...to here
libbpf-1.6.2/src/linker.c:2995:28: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/linker.c:3001:71: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3003:20: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/linker.c:3004:28: branch_true: ...to here
libbpf-1.6.2/src/linker.c:3004:28: branch_true: following ‘true’ branch (when ‘core_relo_rec_sz == 0’)...
libbpf-1.6.2/src/linker.c:3005:52: branch_true: ...to here
libbpf-1.6.2/src/linker.c:3006:28: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/linker.c:3012:76: branch_false: ...to here
libbpf-1.6.2/src/linker.c:2978:21: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/linker.c:3016:13: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3016:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/linker.c:3020:12: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3020:12: branch_false: following ‘false’ branch (when ‘funcs_sz == 0’)...
libbpf-1.6.2/src/linker.c:3024:12: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3033:22: acquire_memory: allocated here
libbpf-1.6.2/src/linker.c:3034:12: branch_false: following ‘false’ branch (when ‘data’ is non-NULL)...
libbpf-1.6.2/src/linker.c:3038:9: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3052:12: branch_false: following ‘false’ branch (when ‘funcs_sz == 0’)...
libbpf-1.6.2/src/linker.c:3069:12: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3086:12: branch_false: following ‘false’ branch (when ‘core_relos_sz == 0’)...
libbpf-1.6.2/src/linker.c:3103:27: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3103:27: danger: ‘data’ leaks here; was allocated at [(23)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/22)
# 3101|   	}
# 3102|   
# 3103|-> 	linker->btf_ext = btf_ext__new(data, total_sz);
# 3104|   	err = libbpf_get_error(linker->btf_ext);
# 3105|   	if (err) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def35]
libbpf-1.6.2/src/linker.c:3104:15: warning[-Wanalyzer-malloc-leak]: leak of ‘data’
libbpf-1.6.2/src/linker.c:2978:21: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/linker.c:2979:40: branch_true: ...to here
libbpf-1.6.2/src/linker.c:2981:20: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/linker.c:2992:21: branch_false: ...to here
libbpf-1.6.2/src/linker.c:2992:20: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/linker.c:2993:28: branch_true: ...to here
libbpf-1.6.2/src/linker.c:2993:28: branch_true: following ‘true’ branch (when ‘line_rec_sz == 0’)...
libbpf-1.6.2/src/linker.c:2994:47: branch_true: ...to here
libbpf-1.6.2/src/linker.c:2995:28: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/linker.c:3001:71: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3003:20: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/linker.c:3004:28: branch_true: ...to here
libbpf-1.6.2/src/linker.c:3004:28: branch_true: following ‘true’ branch (when ‘core_relo_rec_sz == 0’)...
libbpf-1.6.2/src/linker.c:3005:52: branch_true: ...to here
libbpf-1.6.2/src/linker.c:3006:28: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/linker.c:3012:76: branch_false: ...to here
libbpf-1.6.2/src/linker.c:2978:21: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/linker.c:3016:13: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3016:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/linker.c:3020:12: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3020:12: branch_false: following ‘false’ branch (when ‘funcs_sz == 0’)...
libbpf-1.6.2/src/linker.c:3024:12: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3033:22: acquire_memory: allocated here
libbpf-1.6.2/src/linker.c:3034:12: branch_false: following ‘false’ branch (when ‘data’ is non-NULL)...
libbpf-1.6.2/src/linker.c:3038:9: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3052:12: branch_false: following ‘false’ branch (when ‘funcs_sz == 0’)...
libbpf-1.6.2/src/linker.c:3069:12: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3086:12: branch_false: following ‘false’ branch (when ‘core_relos_sz == 0’)...
libbpf-1.6.2/src/linker.c:3103:27: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3104:15: danger: ‘data’ leaks here; was allocated at [(23)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/22)
# 3102|   
# 3103|   	linker->btf_ext = btf_ext__new(data, total_sz);
# 3104|-> 	err = libbpf_get_error(linker->btf_ext);
# 3105|   	if (err) {
# 3106|   		linker->btf_ext = NULL;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def36]
libbpf-1.6.2/src/linker.c:3107:17: warning[-Wanalyzer-malloc-leak]: leak of ‘data’
libbpf-1.6.2/src/linker.c:2978:21: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/linker.c:2979:40: branch_true: ...to here
libbpf-1.6.2/src/linker.c:2981:20: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/linker.c:2992:21: branch_false: ...to here
libbpf-1.6.2/src/linker.c:2992:20: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/linker.c:2993:28: branch_true: ...to here
libbpf-1.6.2/src/linker.c:2993:28: branch_true: following ‘true’ branch (when ‘line_rec_sz == 0’)...
libbpf-1.6.2/src/linker.c:2994:47: branch_true: ...to here
libbpf-1.6.2/src/linker.c:2995:28: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/linker.c:3001:71: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3003:20: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/linker.c:3004:28: branch_true: ...to here
libbpf-1.6.2/src/linker.c:3004:28: branch_true: following ‘true’ branch (when ‘core_relo_rec_sz == 0’)...
libbpf-1.6.2/src/linker.c:3005:52: branch_true: ...to here
libbpf-1.6.2/src/linker.c:3006:28: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/linker.c:3012:76: branch_false: ...to here
libbpf-1.6.2/src/linker.c:2978:21: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/linker.c:3016:13: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3016:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/linker.c:3020:12: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3020:12: branch_false: following ‘false’ branch (when ‘funcs_sz == 0’)...
libbpf-1.6.2/src/linker.c:3024:12: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3033:22: acquire_memory: allocated here
libbpf-1.6.2/src/linker.c:3034:12: branch_false: following ‘false’ branch (when ‘data’ is non-NULL)...
libbpf-1.6.2/src/linker.c:3038:9: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3052:12: branch_false: following ‘false’ branch (when ‘funcs_sz == 0’)...
libbpf-1.6.2/src/linker.c:3069:12: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3086:12: branch_false: following ‘false’ branch (when ‘core_relos_sz == 0’)...
libbpf-1.6.2/src/linker.c:3103:27: branch_false: ...to here
libbpf-1.6.2/src/linker.c:3105:12: branch_true: following ‘true’ branch (when ‘err != 0’)...
libbpf-1.6.2/src/linker.c:3106:17: branch_true: ...to here
libbpf-1.6.2/src/linker.c:3107:17: danger: ‘data’ leaks here; was allocated at [(23)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/22)
# 3105|   	if (err) {
# 3106|   		linker->btf_ext = NULL;
# 3107|-> 		pr_warn("failed to parse final .BTF.ext data: %s\n", errstr(err));
# 3108|   		goto out;
# 3109|   	}

Error: GCC_ANALYZER_WARNING (CWE-775): [#def37]
libbpf-1.6.2/src/netlink.c:91:9: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘sock’
libbpf-1.6.2/src/netlink.c:645:5: enter_function: entry to ‘bpf_tc_hook_destroy’
libbpf-1.6.2/src/netlink.c:647:12: branch_false: following ‘false’ branch (when ‘hook’ is non-NULL)...
libbpf-1.6.2/src/netlink.c:647:23: branch_false: ...to here
libbpf-1.6.2/src/netlink.c:647:22: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/netlink.c:648:13: branch_true: ...to here
libbpf-1.6.2/src/netlink.c:648:13: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/netlink.c:651:17: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/netlink.c:651:17: branch_true: ...to here
libbpf-1.6.2/src/netlink.c:657:24: call_function: inlined call to ‘tc_qdisc_delete’ from ‘bpf_tc_hook_destroy’
#   89|   
#   90|   cleanup:
#   91|-> 	close(sock);
#   92|   	return ret;
#   93|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def38]
libbpf-1.6.2/src/netlink.c:111:23: warning[-Wanalyzer-malloc-leak]: leak of ‘iov.iov_base’
libbpf-1.6.2/src/netlink.c:645:5: enter_function: entry to ‘bpf_tc_hook_destroy’
libbpf-1.6.2/src/netlink.c:647:12: branch_false: following ‘false’ branch (when ‘hook’ is non-NULL)...
libbpf-1.6.2/src/netlink.c:647:23: branch_false: ...to here
libbpf-1.6.2/src/netlink.c:647:22: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/netlink.c:648:13: branch_true: ...to here
libbpf-1.6.2/src/netlink.c:648:13: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/netlink.c:651:17: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/netlink.c:651:17: branch_true: ...to here
libbpf-1.6.2/src/netlink.c:657:24: call_function: inlined call to ‘tc_qdisc_delete’ from ‘bpf_tc_hook_destroy’
#  109|   
#  110|   	do {
#  111|-> 		len = recvmsg(sock, mhdr, flags);
#  112|   	} while (len < 0 && (errno == EINTR || errno == EAGAIN));
#  113|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def39]
libbpf-1.6.2/src/ringbuf.c:89:15: warning[-Wanalyzer-malloc-leak]: leak of ‘rb’
libbpf-1.6.2/src/ringbuf.c:191:1: enter_function: entry to ‘ring_buffer__new’
libbpf-1.6.2/src/ringbuf.c:200:14: acquire_memory: allocated here
libbpf-1.6.2/src/ringbuf.c:201:12: branch_false: following ‘false’ branch (when ‘rb’ is non-NULL)...
libbpf-1.6.2/src/ringbuf.c:204:25: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:207:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/ringbuf.c:213:15: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:213:15: call_function: calling ‘ring_buffer__add’ from ‘ring_buffer__new’
#   87|   	memset(&info, 0, sizeof(info));
#   88|   
#   89|-> 	err = bpf_map_get_info_by_fd(map_fd, &info, &len);
#   90|   	if (err) {
#   91|   		err = -errno;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def40]
libbpf-1.6.2/src/ringbuf.c:92:17: warning[-Wanalyzer-malloc-leak]: leak of ‘rb’
libbpf-1.6.2/src/ringbuf.c:191:1: enter_function: entry to ‘ring_buffer__new’
libbpf-1.6.2/src/ringbuf.c:200:14: acquire_memory: allocated here
libbpf-1.6.2/src/ringbuf.c:201:12: branch_false: following ‘false’ branch (when ‘rb’ is non-NULL)...
libbpf-1.6.2/src/ringbuf.c:204:25: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:207:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/ringbuf.c:213:15: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:213:15: call_function: calling ‘ring_buffer__add’ from ‘ring_buffer__new’
#   90|   	if (err) {
#   91|   		err = -errno;
#   92|-> 		pr_warn("ringbuf: failed to get map info for fd=%d: %s\n",
#   93|   			map_fd, errstr(err));
#   94|   		return libbpf_err(err);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def41]
libbpf-1.6.2/src/ringbuf.c:98:17: warning[-Wanalyzer-malloc-leak]: leak of ‘rb’
libbpf-1.6.2/src/ringbuf.c:191:1: enter_function: entry to ‘ring_buffer__new’
libbpf-1.6.2/src/ringbuf.c:200:14: acquire_memory: allocated here
libbpf-1.6.2/src/ringbuf.c:201:12: branch_false: following ‘false’ branch (when ‘rb’ is non-NULL)...
libbpf-1.6.2/src/ringbuf.c:204:25: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:207:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/ringbuf.c:213:15: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:213:15: call_function: calling ‘ring_buffer__add’ from ‘ring_buffer__new’
#   96|   
#   97|   	if (info.type != BPF_MAP_TYPE_RINGBUF) {
#   98|-> 		pr_warn("ringbuf: map fd=%d is not BPF_MAP_TYPE_RINGBUF\n",
#   99|   			map_fd);
#  100|   		return libbpf_err(-EINVAL);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def42]
libbpf-1.6.2/src/ringbuf.c:127:17: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
libbpf-1.6.2/src/ringbuf.c:191:1: enter_function: entry to ‘ring_buffer__new’
libbpf-1.6.2/src/ringbuf.c:201:12: branch_false: following ‘false’ branch (when ‘rb’ is non-NULL)...
libbpf-1.6.2/src/ringbuf.c:204:25: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:207:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/ringbuf.c:213:15: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:213:15: call_function: calling ‘ring_buffer__add’ from ‘ring_buffer__new’
#  125|   	if (tmp == MAP_FAILED) {
#  126|   		err = -errno;
#  127|-> 		pr_warn("ringbuf: failed to mmap consumer page for map fd=%d: %s\n",
#  128|   			map_fd, errstr(err));
#  129|   		goto err_out;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def43]
libbpf-1.6.2/src/ringbuf.c:127:17: warning[-Wanalyzer-malloc-leak]: leak of ‘rb’
libbpf-1.6.2/src/ringbuf.c:191:1: enter_function: entry to ‘ring_buffer__new’
libbpf-1.6.2/src/ringbuf.c:200:14: acquire_memory: allocated here
libbpf-1.6.2/src/ringbuf.c:201:12: branch_false: following ‘false’ branch (when ‘rb’ is non-NULL)...
libbpf-1.6.2/src/ringbuf.c:204:25: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:207:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/ringbuf.c:213:15: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:213:15: call_function: calling ‘ring_buffer__add’ from ‘ring_buffer__new’
#  125|   	if (tmp == MAP_FAILED) {
#  126|   		err = -errno;
#  127|-> 		pr_warn("ringbuf: failed to mmap consumer page for map fd=%d: %s\n",
#  128|   			map_fd, errstr(err));
#  129|   		goto err_out;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def44]
libbpf-1.6.2/src/ringbuf.c:146:17: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
libbpf-1.6.2/src/ringbuf.c:191:1: enter_function: entry to ‘ring_buffer__new’
libbpf-1.6.2/src/ringbuf.c:201:12: branch_false: following ‘false’ branch (when ‘rb’ is non-NULL)...
libbpf-1.6.2/src/ringbuf.c:204:25: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:207:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/ringbuf.c:213:15: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:213:15: call_function: calling ‘ring_buffer__add’ from ‘ring_buffer__new’
#  144|   	if (tmp == MAP_FAILED) {
#  145|   		err = -errno;
#  146|-> 		pr_warn("ringbuf: failed to mmap data pages for map fd=%d: %s\n",
#  147|   			map_fd, errstr(err));
#  148|   		goto err_out;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def45]
libbpf-1.6.2/src/ringbuf.c:146:17: warning[-Wanalyzer-malloc-leak]: leak of ‘rb’
libbpf-1.6.2/src/ringbuf.c:191:1: enter_function: entry to ‘ring_buffer__new’
libbpf-1.6.2/src/ringbuf.c:200:14: acquire_memory: allocated here
libbpf-1.6.2/src/ringbuf.c:201:12: branch_false: following ‘false’ branch (when ‘rb’ is non-NULL)...
libbpf-1.6.2/src/ringbuf.c:204:25: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:207:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/ringbuf.c:213:15: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:213:15: call_function: calling ‘ring_buffer__add’ from ‘ring_buffer__new’
#  144|   	if (tmp == MAP_FAILED) {
#  145|   		err = -errno;
#  146|-> 		pr_warn("ringbuf: failed to mmap data pages for map fd=%d: %s\n",
#  147|   			map_fd, errstr(err));
#  148|   		goto err_out;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def46]
libbpf-1.6.2/src/ringbuf.c:209:17: warning[-Wanalyzer-malloc-leak]: leak of ‘rb’
libbpf-1.6.2/src/ringbuf.c:200:14: acquire_memory: allocated here
libbpf-1.6.2/src/ringbuf.c:201:12: branch_false: following ‘false’ branch (when ‘rb’ is non-NULL)...
libbpf-1.6.2/src/ringbuf.c:204:25: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:207:12: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/ringbuf.c:208:24: branch_true: ...to here
libbpf-1.6.2/src/ringbuf.c:209:17: danger: ‘rb’ leaks here; was allocated at [(1)](sarif:/runs/0/results/12/codeFlows/0/threadFlows/0/locations/0)
#  207|   	if (rb->epoll_fd < 0) {
#  208|   		err = -errno;
#  209|-> 		pr_warn("ringbuf: failed to create epoll instance: %s\n", errstr(err));
#  210|   		goto err_out;
#  211|   	}

Error: GCC_ANALYZER_WARNING (CWE-401): [#def47]
libbpf-1.6.2/src/ringbuf.c:459:15: warning[-Wanalyzer-malloc-leak]: leak of ‘rb’
libbpf-1.6.2/src/ringbuf.c:519:1: enter_function: entry to ‘user_ring_buffer__new’
libbpf-1.6.2/src/ringbuf.c:527:14: acquire_memory: allocated here
libbpf-1.6.2/src/ringbuf.c:528:12: branch_false: following ‘false’ branch (when ‘rb’ is non-NULL)...
libbpf-1.6.2/src/ringbuf.c:531:25: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:534:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/ringbuf.c:540:15: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:540:15: call_function: calling ‘user_ringbuf_map’ from ‘user_ring_buffer__new’
#  457|   	memset(&info, 0, sizeof(info));
#  458|   
#  459|-> 	err = bpf_map_get_info_by_fd(map_fd, &info, &len);
#  460|   	if (err) {
#  461|   		err = -errno;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def48]
libbpf-1.6.2/src/ringbuf.c:462:17: warning[-Wanalyzer-malloc-leak]: leak of ‘rb’
libbpf-1.6.2/src/ringbuf.c:519:1: enter_function: entry to ‘user_ring_buffer__new’
libbpf-1.6.2/src/ringbuf.c:527:14: acquire_memory: allocated here
libbpf-1.6.2/src/ringbuf.c:528:12: branch_false: following ‘false’ branch (when ‘rb’ is non-NULL)...
libbpf-1.6.2/src/ringbuf.c:531:25: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:534:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/ringbuf.c:540:15: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:540:15: call_function: calling ‘user_ringbuf_map’ from ‘user_ring_buffer__new’
#  460|   	if (err) {
#  461|   		err = -errno;
#  462|-> 		pr_warn("user ringbuf: failed to get map info for fd=%d: %s\n",
#  463|   			map_fd, errstr(err));
#  464|   		return err;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def49]
libbpf-1.6.2/src/ringbuf.c:468:17: warning[-Wanalyzer-malloc-leak]: leak of ‘rb’
libbpf-1.6.2/src/ringbuf.c:519:1: enter_function: entry to ‘user_ring_buffer__new’
libbpf-1.6.2/src/ringbuf.c:527:14: acquire_memory: allocated here
libbpf-1.6.2/src/ringbuf.c:528:12: branch_false: following ‘false’ branch (when ‘rb’ is non-NULL)...
libbpf-1.6.2/src/ringbuf.c:531:25: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:534:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/ringbuf.c:540:15: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:540:15: call_function: calling ‘user_ringbuf_map’ from ‘user_ring_buffer__new’
#  466|   
#  467|   	if (info.type != BPF_MAP_TYPE_USER_RINGBUF) {
#  468|-> 		pr_warn("user ringbuf: map fd=%d is not BPF_MAP_TYPE_USER_RINGBUF\n", map_fd);
#  469|   		return -EINVAL;
#  470|   	}

Error: GCC_ANALYZER_WARNING (CWE-401): [#def50]
libbpf-1.6.2/src/ringbuf.c:479:17: warning[-Wanalyzer-malloc-leak]: leak of ‘rb’
libbpf-1.6.2/src/ringbuf.c:519:1: enter_function: entry to ‘user_ring_buffer__new’
libbpf-1.6.2/src/ringbuf.c:527:14: acquire_memory: allocated here
libbpf-1.6.2/src/ringbuf.c:528:12: branch_false: following ‘false’ branch (when ‘rb’ is non-NULL)...
libbpf-1.6.2/src/ringbuf.c:531:25: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:534:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/ringbuf.c:540:15: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:540:15: call_function: calling ‘user_ringbuf_map’ from ‘user_ring_buffer__new’
#  477|   	if (tmp == MAP_FAILED) {
#  478|   		err = -errno;
#  479|-> 		pr_warn("user ringbuf: failed to mmap consumer page for map fd=%d: %s\n",
#  480|   			map_fd, errstr(err));
#  481|   		return err;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def51]
libbpf-1.6.2/src/ringbuf.c:499:17: warning[-Wanalyzer-malloc-leak]: leak of ‘rb’
libbpf-1.6.2/src/ringbuf.c:519:1: enter_function: entry to ‘user_ring_buffer__new’
libbpf-1.6.2/src/ringbuf.c:527:14: acquire_memory: allocated here
libbpf-1.6.2/src/ringbuf.c:528:12: branch_false: following ‘false’ branch (when ‘rb’ is non-NULL)...
libbpf-1.6.2/src/ringbuf.c:531:25: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:534:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/ringbuf.c:540:15: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:540:15: call_function: calling ‘user_ringbuf_map’ from ‘user_ring_buffer__new’
#  497|   	if (tmp == MAP_FAILED) {
#  498|   		err = -errno;
#  499|-> 		pr_warn("user ringbuf: failed to mmap data pages for map fd=%d: %s\n",
#  500|   			map_fd, errstr(err));
#  501|   		return err;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def52]
libbpf-1.6.2/src/ringbuf.c:536:17: warning[-Wanalyzer-malloc-leak]: leak of ‘rb’
libbpf-1.6.2/src/ringbuf.c:527:14: acquire_memory: allocated here
libbpf-1.6.2/src/ringbuf.c:528:12: branch_false: following ‘false’ branch (when ‘rb’ is non-NULL)...
libbpf-1.6.2/src/ringbuf.c:531:25: branch_false: ...to here
libbpf-1.6.2/src/ringbuf.c:534:12: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/ringbuf.c:535:24: branch_true: ...to here
libbpf-1.6.2/src/ringbuf.c:536:17: danger: ‘rb’ leaks here; was allocated at [(1)](sarif:/runs/0/results/22/codeFlows/0/threadFlows/0/locations/0)
#  534|   	if (rb->epoll_fd < 0) {
#  535|   		err = -errno;
#  536|-> 		pr_warn("user ringbuf: failed to create epoll instance: %s\n", errstr(err));
#  537|   		goto err_out;
#  538|   	}

Error: GCC_ANALYZER_WARNING (CWE-401): [#def53]
libbpf-1.6.2/src/strset.c:48:16: warning[-Wanalyzer-malloc-leak]: leak of ‘set’
libbpf-1.6.2/src/strset.c:41:30: acquire_memory: allocated here
libbpf-1.6.2/src/strset.c:45:12: branch_false: following ‘false’ branch (when ‘set’ is non-NULL)...
libbpf-1.6.2/src/strset.c:48:16: branch_false: ...to here
libbpf-1.6.2/src/strset.c:48:16: danger: ‘set’ leaks here; was allocated at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#   46|   		return ERR_PTR(-ENOMEM);
#   47|   
#   48|-> 	hash = hashmap__new(strset_hash_fn, strset_equal_fn, set);
#   49|   	if (IS_ERR(hash))
#   50|   		goto err_out;

Error: CPPCHECK_WARNING (CWE-457): [#def54]
libbpf-1.6.2/src/strset.c:131: error[uninitvar]: Uninitialized variable: old_off
#  129|   
#  130|   	if (hashmap__find(set->strs_hash, new_off, &old_off))
#  131|-> 		return old_off;
#  132|   
#  133|   	return -ENOENT;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def55]
libbpf-1.6.2/src/usdt.c:281:31: warning[-Wanalyzer-malloc-leak]: leak of ‘man’
libbpf-1.6.2/src/usdt.c:265:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/usdt.c:270:15: branch_false: ...to here
libbpf-1.6.2/src/usdt.c:270:15: acquire_memory: allocated here
libbpf-1.6.2/src/usdt.c:271:12: branch_false: following ‘false’ branch (when ‘man’ is non-NULL)...
libbpf-1.6.2/src/usdt.c:274:9: branch_false: ...to here
libbpf-1.6.2/src/usdt.c:281:31: danger: ‘man’ leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  279|   	 * Added in: 7adfc6c9b315 ("bpf: Add bpf_get_attach_cookie() BPF helper to access bpf_cookie value")
#  280|   	 */
#  281|-> 	man->has_bpf_cookie = kernel_supports(obj, FEAT_BPF_COOKIE);
#  282|   
#  283|   	/* Detect kernel support for automatic refcounting of USDT semaphore.

Error: GCC_ANALYZER_WARNING (CWE-401): [#def56]
libbpf-1.6.2/src/usdt.c:293:33: warning[-Wanalyzer-malloc-leak]: leak of ‘man’
libbpf-1.6.2/src/usdt.c:265:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/usdt.c:270:15: branch_false: ...to here
libbpf-1.6.2/src/usdt.c:270:15: acquire_memory: allocated here
libbpf-1.6.2/src/usdt.c:271:12: branch_false: following ‘false’ branch (when ‘man’ is non-NULL)...
libbpf-1.6.2/src/usdt.c:274:9: branch_false: ...to here
libbpf-1.6.2/src/usdt.c:293:33: danger: ‘man’ leaks here; was allocated at [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2)
#  291|   	 * usdt probes.
#  292|   	 */
#  293|-> 	man->has_uprobe_multi = kernel_supports(obj, FEAT_UPROBE_MULTI_LINK);
#  294|   	return man;
#  295|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def57]
libbpf-1.6.2/src/usdt.c:876:25: warning[-Wanalyzer-malloc-leak]: leak of ‘*man.free_spec_ids’
libbpf-1.6.2/src/usdt.c:823:12: enter_function: entry to ‘bpf_link_usdt_detach’
libbpf-1.6.2/src/usdt.c:851:12: branch_false: following ‘false’ branch...
libbpf-1.6.2/src/usdt.c:858:34: branch_false: ...to here
libbpf-1.6.2/src/usdt.c:861:32: call_function: inlined call to ‘libbpf_reallocarray’ from ‘bpf_link_usdt_detach’
libbpf-1.6.2/src/usdt.c:872:20: branch_true: following ‘true’ branch...
libbpf-1.6.2/src/usdt.c:874:32: branch_true: ...to here
libbpf-1.6.2/src/usdt.c:876:25: danger: ‘*man.free_spec_ids’ leaks here; was allocated at [(7)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/6)
#  874|   			       usdt_link->spec_cnt * sizeof(*usdt_link->spec_ids));
#  875|   			man->free_spec_ids = new_free_ids;
#  876|-> 			man->free_spec_cnt = new_cnt;
#  877|   		}
#  878|   	}

Error: CPPCHECK_WARNING (CWE-457): [#def58]
libbpf-1.6.2/src/usdt.c:912: error[uninitvar]: Uninitialized variable: tmp
#  910|   	/* check if we already allocated spec ID for this spec string */
#  911|   	if (hashmap__find(specs_hash, target->spec_str, &tmp)) {
#  912|-> 		*spec_id = tmp;
#  913|   		*is_new = false;
#  914|   		return 0;

Scan Properties

analyzer-version-clippy1.90.0
analyzer-version-cppcheck2.18.3
analyzer-version-gcc15.2.1
analyzer-version-gcc-analyzer16.0.0
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-14.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch
mock-configfedora-rawhide-gcc-latest-x86_64
project-namelibbpf-1.6.2-1.fc44
store-results-to/tmp/tmpf4y3d27p/libbpf-1.6.2-1.fc44.tar.xz
time-created2025-10-28 19:01:01
time-finished2025-10-28 19:03:07
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'gcc,cppcheck,shellcheck,clippy,unicontrol' '-o' '/tmp/tmpf4y3d27p/libbpf-1.6.2-1.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpf4y3d27p/libbpf-1.6.2-1.fc44.src.rpm'
tool-versioncsmock-3.8.3.20251027.143044.ge6b947b-1.el9