libbpf-1.5.0-1.fc42

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1]
libbpf-1.5.0-build/libbpf-1.5.0/include/linux/err.h:25:29: warning[-Wanalyzer-malloc-leak]: leak of ‘btf_new_empty(0)’
libbpf-1.5.0-build/libbpf-1.5.0/include/linux/err.h:11:27: note: in definition of macro ‘IS_ERR_VALUE’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘libbpf_ptr’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c:22: included_from: Included from here.
libbpf-1.5.0-build/libbpf-1.5.0/include/linux/err.h:11:27: note: in definition of macro ‘IS_ERR_VALUE’
#   23|   static inline bool IS_ERR(const void *ptr)
#   24|   {
#   25|-> 	return IS_ERR_VALUE((unsigned long)ptr);
#   26|   }
#   27|   

Error: GCC_ANALYZER_WARNING (CWE-122): [#def2]
libbpf-1.5.0-build/libbpf-1.5.0/src/bpf_prog_linfo.c: scope_hint: In function ‘dissect_jited_func’
libbpf-1.5.0-build/libbpf-1.5.0/src/bpf_prog_linfo.c:79:64: warning[-Wanalyzer-out-of-bounds]: heap-based buffer overflow
cc1: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics
#   77|   		goto errout;
#   78|   
#   79|-> 	prog_linfo->nr_jited_linfo_per_func[nr_jited_func - 1] =
#   80|   		nr_linfo - prev_i;
#   81|   

Error: GCC_ANALYZER_WARNING (CWE-122): [#def3]
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘libbpf_add_mem’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c:171:9: warning[-Wanalyzer-out-of-bounds]: heap-based buffer overflow
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘libbpf_add_mem’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘libbpf_add_mem’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘libbpf_add_mem’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘libbpf_add_mem’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘libbpf_add_mem’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘libbpf_add_mem’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘libbpf_add_mem’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c:171:9: note: write of 15 bytes to beyond the end of the region
#  169|   
#  170|   	/* zero out newly allocated portion of memory */
#  171|-> 	memset(new_data + (*cap_cnt) * elem_sz, 0, (new_cnt - *cap_cnt) * elem_sz);
#  172|   
#  173|   	*data = new_data;

Error: CPPCHECK_WARNING (CWE-457): [#def4]
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c:1805: error[uninitvar]: Uninitialized variable: mapped_off
# 1803|   	if (p->str_off_map &&
# 1804|   	    hashmap__find(p->str_off_map, *str_off, &mapped_off)) {
# 1805|-> 		*str_off = mapped_off;
# 1806|   		return 0;
# 1807|   	}

Error: GCC_ANALYZER_WARNING (CWE-122): [#def5]
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_composite’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c:2193:21: warning[-Wanalyzer-out-of-bounds]: heap-based buffer overflow
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_composite’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_composite’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_composite’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_composite’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_composite’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_composite’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_composite’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c:2193:21: note: write of 3 bytes to beyond the end of the region
# 2191|   	 * adding each member
# 2192|   	 */
# 2193|-> 	t->name_off = name_off;
# 2194|   	t->info = btf_type_info(kind, 0, 0);
# 2195|   	t->size = bytes_sz;

Error: GCC_ANALYZER_WARNING (CWE-122): [#def6]
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c:2194:17: warning[-Wanalyzer-out-of-bounds]: heap-based buffer overflow
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_composite’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_composite’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_composite’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_composite’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_composite’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_composite’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_composite’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c:2194:17: note: write of 4 bytes to beyond the end of the region
# 2192|   	 */
# 2193|   	t->name_off = name_off;
# 2194|-> 	t->info = btf_type_info(kind, 0, 0);
# 2195|   	t->size = bytes_sz;
# 2196|   

Error: GCC_ANALYZER_WARNING (CWE-122): [#def7]
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c:2195:17: warning[-Wanalyzer-out-of-bounds]: heap-based buffer overflow
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_composite’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_composite’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_composite’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_composite’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_composite’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_composite’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_composite’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c:2195:17: note: write of 4 bytes to beyond the end of the region
# 2193|   	t->name_off = name_off;
# 2194|   	t->info = btf_type_info(kind, 0, 0);
# 2195|-> 	t->size = bytes_sz;
# 2196|   
# 2197|   	return btf_commit_type(btf, sz);

Error: GCC_ANALYZER_WARNING (CWE-122): [#def8]
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_enum_common’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c:2330:21: warning[-Wanalyzer-out-of-bounds]: heap-based buffer overflow
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_enum_common’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_enum_common’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_enum_common’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_enum_common’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_enum_common’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_enum_common’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_enum_common’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_enum_common’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c:2330:21: note: write of 3 bytes to beyond the end of the region
# 2328|   
# 2329|   	/* start out with vlen=0; it will be adjusted when adding enum values */
# 2330|-> 	t->name_off = name_off;
# 2331|   	t->info = btf_type_info(kind, 0, is_signed);
# 2332|   	t->size = byte_sz;

Error: GCC_ANALYZER_WARNING (CWE-122): [#def9]
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c:2331:17: warning[-Wanalyzer-out-of-bounds]: heap-based buffer overflow
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_enum_common’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_enum_common’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_enum_common’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_enum_common’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_enum_common’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_enum_common’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_enum_common’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_enum_common’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c:2331:17: note: write of 4 bytes to beyond the end of the region
# 2329|   	/* start out with vlen=0; it will be adjusted when adding enum values */
# 2330|   	t->name_off = name_off;
# 2331|-> 	t->info = btf_type_info(kind, 0, is_signed);
# 2332|   	t->size = byte_sz;
# 2333|   

Error: GCC_ANALYZER_WARNING (CWE-122): [#def10]
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c:2332:17: warning[-Wanalyzer-out-of-bounds]: heap-based buffer overflow
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_enum_common’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_enum_common’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_enum_common’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_enum_common’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_enum_common’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_enum_common’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_enum_common’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘btf_add_enum_common’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c:2332:17: note: write of 4 bytes to beyond the end of the region
# 2330|   	t->name_off = name_off;
# 2331|   	t->info = btf_type_info(kind, 0, is_signed);
# 2332|-> 	t->size = byte_sz;
# 2333|   
# 2334|   	return btf_commit_type(btf, sz);

Error: CPPCHECK_WARNING (CWE-457): [#def11]
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c:4997: error[uninitvar]: Uninitialized variable: cand_id
# 4995|   
# 4996|   	/* Zero is a special value indicating that name is not unique */
# 4997|-> 	if (!cand_id)
# 4998|   		return 0;
# 4999|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def12]
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.h:361:31: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
libbpf-1.5.0-build/libbpf-1.5.0/include/uapi/linux/btf.h:55:36: note: in definition of macro ‘BTF_INFO_KIND’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c: scope_hint: In function ‘determine_ptr_size.part.0’
libbpf-1.5.0-build/libbpf-1.5.0/src/btf.c:19: included_from: Included from here.
libbpf-1.5.0-build/libbpf-1.5.0/include/uapi/linux/btf.h:55:36: note: in definition of macro ‘BTF_INFO_KIND’
#  359|   static inline __u16 btf_kind(const struct btf_type *t)
#  360|   {
#  361|-> 	return BTF_INFO_KIND(t->info);
#  362|   }
#  363|   

Error: CPPCHECK_WARNING (CWE-457): [#def13]
libbpf-1.5.0-build/libbpf-1.5.0/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: CPPCHECK_WARNING (CWE-758): [#def14]
libbpf-1.5.0-build/libbpf-1.5.0/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): [#def15]
libbpf-1.5.0-build/libbpf-1.5.0/src/libbpf_internal.h: scope_hint: In function ‘libbpf_ptr’
libbpf-1.5.0-build/libbpf-1.5.0/src/libbpf_internal.h:607:35: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
#  605|   		errno = -PTR_ERR(ret);
#  606|   
#  607|-> 	return IS_ERR(ret) ? NULL : ret;
#  608|   }
#  609|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def16]
libbpf-1.5.0-build/libbpf-1.5.0/src/linker.c: scope_hint: In function ‘add_new_sym’
libbpf-1.5.0-build/libbpf-1.5.0/src/linker.c:286:15: warning[-Wanalyzer-malloc-leak]: leak of ‘realloc(*symtab.raw_data,  __real__ <unknown>)’
libbpf-1.5.0-build/libbpf-1.5.0/src/linker.c: scope_hint: In function ‘add_new_sym’
#  284|   
#  285|   	symtab->raw_data = syms;
#  286|-> 	symtab->sec_sz += sizeof(*sym);
#  287|   	symtab->shdr->sh_size += sizeof(*sym);
#  288|   	symtab->data->d_size += sizeof(*sym);

Error: CPPCHECK_WARNING (CWE-476): [#def17]
libbpf-1.5.0-build/libbpf-1.5.0/src/linker.c:1571: error[ctunullpointer]: Null pointer dereference: extra_def
# 1569|   	const char *reason;
# 1570|   
# 1571|-> 	if (main_def->map_type != extra_def->map_type) {
# 1572|   		reason = "type";
# 1573|   		goto mismatch;

Error: CPPCHECK_WARNING (CWE-476): [#def18]
libbpf-1.5.0-build/libbpf-1.5.0/src/linker.c:1571: error[ctunullpointer]: Null pointer dereference: main_def
# 1569|   	const char *reason;
# 1570|   
# 1571|-> 	if (main_def->map_type != extra_def->map_type) {
# 1572|   		reason = "type";
# 1573|   		goto mismatch;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def19]
libbpf-1.5.0-build/libbpf-1.5.0/src/linker.c: scope_hint: In function ‘linker_append_btf’
libbpf-1.5.0-build/libbpf-1.5.0/src/linker.c:2439:45: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
cc1: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics
# 2437|   				name = btf__str_by_offset(linker->btf, t->name_off);
# 2438|   				glob_sym = find_glob_sym(linker, name);
# 2439|-> 				if (glob_sym->sec_id != dst_sec->id) {
# 2440|   					pr_warn("global '%s': section mismatch %d vs %d\n",
# 2441|   						name, glob_sym->sec_id, dst_sec->id);

Error: CPPCHECK_WARNING (CWE-457): [#def20]
libbpf-1.5.0-build/libbpf-1.5.0/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): [#def21]
libbpf-1.5.0-build/libbpf-1.5.0/src/usdt.c: scope_hint: In function ‘bpf_link_usdt_detach’
libbpf-1.5.0-build/libbpf-1.5.0/src/usdt.c:874:44: warning[-Wanalyzer-malloc-leak]: leak of ‘*man.free_spec_ids’
libbpf-1.5.0-build/libbpf-1.5.0/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: CPPCHECK_WARNING (CWE-457): [#def22]
libbpf-1.5.0-build/libbpf-1.5.0/src/usdt.c:910: error[uninitvar]: Uninitialized variable: tmp
#  908|   	/* check if we already allocated spec ID for this spec string */
#  909|   	if (hashmap__find(specs_hash, target->spec_str, &tmp)) {
#  910|-> 		*spec_id = tmp;
#  911|   		*is_new = false;
#  912|   		return 0;

Scan Properties

analyzer-version-clippy1.82.0
analyzer-version-cppcheck2.16.0
analyzer-version-gcc14.2.1
analyzer-version-gcc-analyzer15.0.0
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-134.us-west-2.compute.internal
mock-configfedora-rawhide-gcc-latest-x86_64
project-namelibbpf-1.5.0-1.fc42
store-results-to/tmp/tmpg8468kpt/libbpf-1.5.0-1.fc42.tar.xz
time-created2024-11-13 01:17:58
time-finished2024-11-13 01:20:07
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmpg8468kpt/libbpf-1.5.0-1.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpg8468kpt/libbpf-1.5.0-1.fc42.src.rpm'
tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9