Fixed defects

List of Defects

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1]
libbpf-1.2.0-build/libbpf-1.2.0/src/btf.c: scope_hint: In function ‘btf_parse_elf.part.0’
libbpf-1.2.0-build/libbpf-1.2.0/src/btf.c:935:24: warning[-Wanalyzer-malloc-leak]: leak of ‘btf’
#  933|   	if (elf_version(EV_CURRENT) == EV_NONE) {
#  934|   		pr_warn("failed to init libelf for %s\n", path);
#  935|-> 		return ERR_PTR(-LIBBPF_ERRNO__LIBELF);
#  936|   	}
#  937|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
libbpf-1.2.0-build/libbpf-1.2.0/src/btf.c: scope_hint: In function ‘btf_parse’
libbpf-1.2.0-build/libbpf-1.2.0/src/btf.c:1078:19: warning[-Wanalyzer-malloc-leak]: leak of ‘btf_parse_raw(path,  base_btf)’
# 1076|   		goto err_out;
# 1077|   	}
# 1078|-> 	if (magic != BTF_MAGIC && magic != bswap_16(BTF_MAGIC)) {
# 1079|   		/* definitely not a raw BTF */
# 1080|   		err = -EPROTO;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def3]
libbpf-1.2.0-build/libbpf-1.2.0/src/btf.h:327:31: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘t’
libbpf-1.2.0-build/libbpf-1.2.0/include/uapi/linux/btf.h:56:35: note: in definition of macro ‘BTF_INFO_VLEN’
libbpf-1.2.0-build/libbpf-1.2.0/src/btf.c: scope_hint: In function ‘btf_type_size’
libbpf-1.2.0-build/libbpf-1.2.0/include/uapi/linux/btf.h:56:35: note: in definition of macro ‘BTF_INFO_VLEN’
#  325|   static inline __u16 btf_vlen(const struct btf_type *t)
#  326|   {
#  327|-> 	return BTF_INFO_VLEN(t->info);
#  328|   }
#  329|   

Scan Properties

analyzer-version-clang18.1.7
analyzer-version-cppcheck2.14.2
analyzer-version-gcc14.1.1
analyzer-version-gcc-analyzer14.1.1
analyzer-version-shellcheck0.10.0
diffbase-analyzer-version-clang18.1.7
diffbase-analyzer-version-cppcheck2.14.2
diffbase-analyzer-version-gcc14.1.1
diffbase-analyzer-version-gcc-analyzer14.1.1
diffbase-analyzer-version-shellcheck0.10.0
diffbase-enabled-pluginsclang, cppcheck, gcc, shellcheck
diffbase-exit-code0
diffbase-hostip-172-16-1-7.us-west-2.compute.internal
diffbase-mock-configfedora-41-x86_64
diffbase-project-namelibbpf-1.4.3-1.fc41
diffbase-store-results-to/tmp/tmp9y9xyj6k/libbpf-1.4.3-1.fc41.tar.xz
diffbase-time-created2024-07-03 14:33:20
diffbase-time-finished2024-07-03 14:35:02
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmp9y9xyj6k/libbpf-1.4.3-1.fc41.tar.xz' '--gcc-analyze' '/tmp/tmp9y9xyj6k/libbpf-1.4.3-1.fc41.src.rpm'
diffbase-tool-versioncsmock-3.5.3-1.el9
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-7.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-namelibbpf-1.2.0-3.fc40
store-results-to/tmp/tmp79lrlmct/libbpf-1.2.0-3.fc40.tar.xz
time-created2024-07-03 14:30:56
time-finished2024-07-03 14:32:56
titleFixed defects
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmp79lrlmct/libbpf-1.2.0-3.fc40.tar.xz' '--gcc-analyze' '/tmp/tmp79lrlmct/libbpf-1.2.0-3.fc40.src.rpm'
tool-versioncsmock-3.5.3-1.el9