Newly introduced defects

List of Defects

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1]
libbpf-1.4.3-build/libbpf-1.4.3/src/btf.c: scope_hint: In function ‘btf__str_by_offset’
libbpf-1.4.3-build/libbpf-1.4.3/src/btf.c:1500:25: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘btf’
libbpf-1.4.3-build/libbpf-1.4.3/src/btf.c: scope_hint: In function ‘btf__str_by_offset’
libbpf-1.4.3-build/libbpf-1.4.3/src/btf.c: scope_hint: In function ‘btf__str_by_offset’
libbpf-1.4.3-build/libbpf-1.4.3/src/btf.c: scope_hint: In function ‘btf__str_by_offset’
cc1: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics
# 1498|   const char *btf__str_by_offset(const struct btf *btf, __u32 offset)
# 1499|   {
# 1500|-> 	if (offset < btf->start_str_off)
# 1501|   		return btf__str_by_offset(btf->base_btf, offset);
# 1502|   	else if (offset - btf->start_str_off < btf->hdr->str_len)

Error: CPPCHECK_WARNING: [#def2]
libbpf-1.4.3-build/libbpf-1.4.3/src/elf.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def3]
libbpf-1.4.3-build/libbpf-1.4.3/src/elf.c:57:2: warning[core.CallAndMessage]: 1st function call argument is an uninitialized value
#   55|   	if (!elf_fd)
#   56|   		return;
#   57|-> 	elf_end(elf_fd->elf);
#   58|   	close(elf_fd->fd);
#   59|   }

Error: CLANG_WARNING: [#def4]
libbpf-1.4.3-build/libbpf-1.4.3/src/elf.c:383:8: warning[core.CallAndMessage]: 1st function call argument is an uninitialized value
#  381|   	if (ret)
#  382|   		return ret;
#  383|-> 	ret = elf_find_func_offset(elf_fd.elf, binary_path, name);
#  384|   	elf_close(&elf_fd);
#  385|   	return ret;

Error: CLANG_WARNING: [#def5]
libbpf-1.4.3-build/libbpf-1.4.3/src/elf.c:440:9: warning[core.CallAndMessage]: 2nd function call argument is an uninitialized value
#  438|   		struct elf_sym *sym;
#  439|   
#  440|-> 		err = elf_sym_iter_new(&iter, elf_fd.elf, binary_path, sh_types[i], st_type);
#  441|   		if (err == -ENOENT)
#  442|   			continue;

Error: CLANG_WARNING: [#def6]
libbpf-1.4.3-build/libbpf-1.4.3/src/elf.c:521:9: warning[core.CallAndMessage]: 2nd function call argument is an uninitialized value
#  519|   		struct elf_sym *sym;
#  520|   
#  521|-> 		err = elf_sym_iter_new(&iter, elf_fd.elf, binary_path, sh_types[i], STT_FUNC);
#  522|   		if (err == -ENOENT)
#  523|   			continue;

Error: CPPCHECK_WARNING (CWE-457): [#def7]
libbpf-1.4.3-build/libbpf-1.4.3/src/features.c:325: error[uninitvar]: Uninitialized variable: name
#  323|   
#  324|   	memset(&info, 0, sizeof(info));
#  325|-> 	info.name = ptr_to_u64(name);
#  326|   	info.name_len = sizeof(name);
#  327|   

Error: CLANG_WARNING: [#def8]
libbpf-1.4.3-build/libbpf-1.4.3/src/usdt.c:871:4: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
#  869|   		 */
#  870|   		if (new_free_ids || new_cnt == 0) {
#  871|-> 			memcpy(new_free_ids + man->free_spec_cnt, usdt_link->spec_ids,
#  872|   			       usdt_link->spec_cnt * sizeof(*usdt_link->spec_ids));
#  873|   			man->free_spec_ids = new_free_ids;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def9]
libbpf-1.4.3-build/libbpf-1.4.3/src/usdt.c: scope_hint: In function ‘bpf_link_usdt_detach’
libbpf-1.4.3-build/libbpf-1.4.3/src/usdt.c:874:44: warning[-Wanalyzer-malloc-leak]: leak of ‘*man.free_spec_ids’
libbpf-1.4.3-build/libbpf-1.4.3/src/usdt.c: scope_hint: In function ‘bpf_link_usdt_detach’
cc1: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics
#  872|   			       usdt_link->spec_cnt * sizeof(*usdt_link->spec_ids));
#  873|   			man->free_spec_ids = new_free_ids;
#  874|-> 			man->free_spec_cnt = new_cnt;
#  875|   		}
#  876|   	}

Error: CLANG_WARNING: [#def10]
libbpf-1.4.3-build/libbpf-1.4.3/src/usdt.c:1069:15: warning[core.NullDereference]: Array access (from variable 'offsets') results in a null pointer dereference
# 1067|   
# 1068|   		if (man->has_uprobe_multi) {
# 1069|-> 			offsets[i] = target->rel_ip;
# 1070|   			ref_ctr_offsets[i] = target->sema_off;
# 1071|   			cookies[i] = spec_id;

Error: CLANG_WARNING: [#def11]
libbpf-1.4.3-build/libbpf-1.4.3/src/usdt.c:1112:2: warning[unix.Malloc]: Potential leak of memory pointed to by 'cookies'
# 1110|   	}
# 1111|   
# 1112|-> 	free(targets);
# 1113|   	hashmap__free(specs_hash);
# 1114|   	elf_close(&elf_fd);

Error: CLANG_WARNING: [#def12]
libbpf-1.4.3-build/libbpf-1.4.3/src/usdt.c:1112:2: warning[unix.Malloc]: Potential leak of memory pointed to by 'offsets'
# 1110|   	}
# 1111|   
# 1112|-> 	free(targets);
# 1113|   	hashmap__free(specs_hash);
# 1114|   	elf_close(&elf_fd);

Error: CLANG_WARNING: [#def13]
libbpf-1.4.3-build/libbpf-1.4.3/src/usdt.c:1112:2: warning[unix.Malloc]: Potential leak of memory pointed to by 'ref_ctr_offsets'
# 1110|   	}
# 1111|   
# 1112|-> 	free(targets);
# 1113|   	hashmap__free(specs_hash);
# 1114|   	elf_close(&elf_fd);

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.2.0-3.fc40
diffbase-store-results-to/tmp/tmp79lrlmct/libbpf-1.2.0-3.fc40.tar.xz
diffbase-time-created2024-07-03 14:30:56
diffbase-time-finished2024-07-03 14:32:56
diffbase-toolcsmock
diffbase-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'
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.4.3-1.fc41
store-results-to/tmp/tmp9y9xyj6k/libbpf-1.4.3-1.fc41.tar.xz
time-created2024-07-03 14:33:20
time-finished2024-07-03 14:35:02
titleNewly introduced defects
toolcsmock
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'
tool-versioncsmock-3.5.3-1.el9