Fixed findings

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1]
util-linux-2.42.start-build/util-linux-2.42.start/disk-utils/cfdisk.c: scope_hint: In function ‘ui_create_label’
util-linux-2.42.start-build/util-linux-2.42.start/disk-utils/cfdisk.c:2183:30: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘xcalloc(fdisk_get_nlabels(*cf.cxt) + 1, 32) + i * 32’
util-linux-2.42.start-build/util-linux-2.42.start/include/debug.h:104:17: note: in expansion of macro ‘__UL_INIT_DEBUG_FROM_STRING’
util-linux-2.42.start-build/util-linux-2.42.start/disk-utils/cfdisk.c:274:9: note: in expansion of macro ‘__UL_INIT_DEBUG_FROM_ENV’
util-linux-2.42.start-build/util-linux-2.42.start/include/debug.h:104:17: note: in expansion of macro ‘__UL_INIT_DEBUG_FROM_STRING’
util-linux-2.42.start-build/util-linux-2.42.start/disk-utils/cfdisk.c:274:9: note: in expansion of macro ‘__UL_INIT_DEBUG_FROM_ENV’
util-linux-2.42.start-build/util-linux-2.42.start/disk-utils/cfdisk.c:270:25: note: in expansion of macro ‘__UL_DBG’
util-linux-2.42.start-build/util-linux-2.42.start/disk-utils/cfdisk.c:2172:9: note: in expansion of macro ‘DBG’
# 2181|   		    fdisk_label_get_type(lb) == FDISK_DISKLABEL_BSD)
# 2182|   			continue;
# 2183|-> 		cm[i++].name = fdisk_label_get_name(lb);
# 2184|   	}
# 2185|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def2]
util-linux-2.42.start-build/util-linux-2.42.start/disk-utils/mkfs.cramfs.c:305:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘xmalloc(len + 257)’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null
#  303|   	/* TODO: Reuse the parent's buffer to save memcpy'ing and duplication. */
#  304|   	path = xmalloc(len + 1 + MAX_INPUT_NAMELEN + 1);
#  305|-> 	memcpy(path, name, len);
#  306|   	endpath = path + len;
#  307|   	*endpath = '/';

Error: GCC_ANALYZER_WARNING (CWE-688): [#def3]
util-linux-2.42.start-build/util-linux-2.42.start/disk-utils/fdisk.c:36: included_from: Included from here.
util-linux-2.42.start-build/util-linux-2.42.start/include/all-io.h: scope_hint: In function ‘read_all’
util-linux-2.42.start-build/util-linux-2.42.start/include/all-io.h:67:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘buf’ where non-null expected
util-linux-2.42.start-build/util-linux-2.42.start/disk-utils/fdisk.h:18: included_from: Included from here.
util-linux-2.42.start-build/util-linux-2.42.start/disk-utils/fdisk.c:47: included_from: Included from here.
util-linux-2.42.start-build/util-linux-2.42.start/disk-utils/fdisk.c:35: included_from: Included from here.
<built-in>: note: argument 1 of ‘__builtin_memset’ must be non-null
#   65|   	int tries = 0;
#   66|   
#   67|-> 	memset(buf, 0, count);
#   68|   	while (count > 0) {
#   69|   		ret = read(fd, buf, count);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def4]
util-linux-2.42.start-build/util-linux-2.42.start/misc-utils/blkid.c:889:43: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘xcalloc((long unsigned int)(argc - optind), 8)’
util-linux-2.42.start-build/util-linux-2.42.start/misc-utils/blkid.c:41: included_from: Included from here.
#  887|   				continue;
#  888|   
#  889|-> 			devices[numdev++] = dev;
#  890|   		}
#  891|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def5]
util-linux-2.42.start-build/util-linux-2.42.start/misc-utils/namei.c: scope_hint: In function ‘readlink_to_namei’
util-linux-2.42.start-build/util-linux-2.42.start/misc-utils/namei.c:115:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘xmalloc((long unsigned int)(sz + 1))’ where non-null expected
util-linux-2.42.start-build/util-linux-2.42.start/misc-utils/namei.c:39: included_from: Included from here.
util-linux-2.42.start-build/util-linux-2.42.start/include/c.h:22: included_from: Included from here.
util-linux-2.42.start-build/util-linux-2.42.start/misc-utils/namei.c:38: included_from: Included from here.
util-linux-2.42.start-build/util-linux-2.42.start/misc-utils/namei.c:29: included_from: Included from here.
<built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null
#  113|   	if (isrel) {
#  114|   		/* create the absolute path from the relative symlink */
#  115|-> 		memcpy(nm->abslink, path, nm->relstart);
#  116|   		*(nm->abslink + nm->relstart) = '/';
#  117|   		nm->relstart++;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def6]
util-linux-2.42.start-build/util-linux-2.42.start/misc-utils/namei.c:123:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘xmalloc((long unsigned int)(sz + 1))’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null
#  121|   		 * - or link without any subdir (foo -> bar)
#  122|   		 */
#  123|-> 		memcpy(nm->abslink, sym, sz);
#  124|   
#  125|   	nm->abslink[sz] = '\0';

Error: GCC_ANALYZER_WARNING (CWE-688): [#def7]
util-linux-2.42.start-build/util-linux-2.42.start/misc-utils/namei.c: scope_hint: In function ‘dotdot_stat’
util-linux-2.42.start-build/util-linux-2.42.start/misc-utils/namei.c:142:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘xmalloc(len + 4)’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null
#  140|   	path = xmalloc(len + sizeof(DOTDOTDIR));
#  141|   
#  142|-> 	memcpy(path, dirname, len);
#  143|   	memcpy(path + len, DOTDOTDIR, sizeof(DOTDOTDIR));
#  144|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def8]
util-linux-2.42.start-build/util-linux-2.42.start/misc-utils/waitpid.c: scope_hint: In function ‘parse_pids’
util-linux-2.42.start-build/util-linux-2.42.start/misc-utils/waitpid.c:54:25: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘xcalloc(n_strings, 4) + i * 4’
util-linux-2.42.start-build/util-linux-2.42.start/include/strutils.h:53:64: note: in definition of macro ‘strtopid_or_err’
util-linux-2.42.start-build/util-linux-2.42.start/misc-utils/waitpid.c:54:55: note: in expansion of macro ‘_’
#   52|   
#   53|   	for (size_t i = 0; i < n_strings; i++)
#   54|-> 		pids[i] = strtopid_or_err(strings[i], _("failed to parse pid"));
#   55|   
#   56|   	return pids;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def9]
util-linux-2.42.start-build/util-linux-2.42.start/misc-utils/wipefs.c: scope_hint: In function ‘get_desc_for_probe’
util-linux-2.42.start-build/util-linux-2.42.start/misc-utils/wipefs.c:350:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘xmalloc(*len)’ where non-null expected
util-linux-2.42.start-build/util-linux-2.42.start/misc-utils/wipefs.c:38: included_from: Included from here.
util-linux-2.42.start-build/util-linux-2.42.start/include/c.h:22: included_from: Included from here.
util-linux-2.42.start-build/util-linux-2.42.start/include/xalloc.h:20: included_from: Included from here.
<built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null
#  348|   
#  349|   	wp->magic = xmalloc(*len);
#  350|-> 	memcpy(wp->magic, mag, *len);
#  351|   	wp->len = *len;
#  352|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def10]
util-linux-2.42.start-build/util-linux-2.42.start/sys-utils/irq-common.c: scope_hint: In function ‘get_scols_table’
util-linux-2.42.start-build/util-linux-2.42.start/sys-utils/irq-common.c:551:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘xmalloc(size)’ where non-null expected
util-linux-2.42.start-build/util-linux-2.42.start/sys-utils/irq-common.c: scope_hint: In function ‘get_scols_table’
<built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null
#  549|   	size = sizeof(*stat->irq_info) * stat->nr_irq;
#  550|   	result = xmalloc(size);
#  551|-> 	memcpy(result, stat->irq_info, size);
#  552|   
#  553|   	if (prev) {

Scan Properties

analyzer-version-clippy1.85.0
analyzer-version-cppcheck2.17 dev
analyzer-version-gcc15.0.1
analyzer-version-gcc-analyzer15.0.1
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.85.0
diffbase-analyzer-version-cppcheck2.17 dev
diffbase-analyzer-version-gcc15.0.1
diffbase-analyzer-version-gcc-analyzer15.0.1
diffbase-analyzer-version-shellcheck0.10.0
diffbase-analyzer-version-unicontrol0.0.2
diffbase-enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code0
diffbase-hostip-172-16-1-79.us-west-2.compute.internal
diffbase-mock-configfedora-rawhide-x86_64
diffbase-project-nameutil-linux-2.42.start-1.20250227095734028016.pr3429.40.g5e0b818a6
diffbase-store-results-to/tmp/tmpu9_ltwms/util-linux-2.42.start-1.20250227095734028016.pr3429.40.g5e0b818a6.tar.xz
diffbase-time-created2025-02-27 10:29:01
diffbase-time-finished2025-02-27 10:44:10
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'shellcheck,unicontrol,clippy,gcc,cppcheck' '-o' '/tmp/tmpu9_ltwms/util-linux-2.42.start-1.20250227095734028016.pr3429.40.g5e0b818a6.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '/tmp/tmpu9_ltwms/util-linux-2.42.start-1.20250227095734028016.pr3429.40.g5e0b818a6.src.rpm'
diffbase-tool-versioncsmock-3.8.0-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-79.us-west-2.compute.internal
mock-configfedora-rawhide-x86_64
project-nameutil-linux-2.42.start-1.20250226123015474302.master.39.g467b0c15b
store-results-to/tmp/tmpk0eypueq/util-linux-2.42.start-1.20250226123015474302.master.39.g467b0c15b.tar.xz
time-created2025-02-27 10:12:26
time-finished2025-02-27 10:28:31
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'shellcheck,unicontrol,clippy,gcc,cppcheck' '-o' '/tmp/tmpk0eypueq/util-linux-2.42.start-1.20250226123015474302.master.39.g467b0c15b.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '/tmp/tmpk0eypueq/util-linux-2.42.start-1.20250226123015474302.master.39.g467b0c15b.src.rpm'
tool-versioncsmock-3.8.0-1.el9