Fixed findings

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1]
util-linux-2.42.start/disk-utils/cfdisk.c: scope_hint: In function ‘ui_get_parttype’
util-linux-2.42.start/disk-utils/cfdisk.c:2023:32: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘xcalloc(fdisk_label_get_nparttypes(fdisk_get_label(*cf.cxt, 0)) + 1, 32) + i * 32’
# 2021|   		char *name;
# 2022|   
# 2023|-> 		cm[i].userdata = (void *) x;
# 2024|   		if (codetypes)
# 2025|   			xasprintf(&name, "%2x %s",

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
util-linux-2.42.start/disk-utils/cfdisk.c:2025:25: warning[-Wanalyzer-malloc-leak]: leak of ‘xcalloc(fdisk_label_get_nparttypes(fdisk_get_label(*cf.cxt, 0)) + 1, 32) + i * 32’
# 2023|   		cm[i].userdata = (void *) x;
# 2024|   		if (codetypes)
# 2025|-> 			xasprintf(&name, "%2x %s",
# 2026|   				fdisk_parttype_get_code(x),
# 2027|   				_(fdisk_parttype_get_name(x)));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def3]
util-linux-2.42.start/disk-utils/cfdisk.c:2029:32: warning[-Wanalyzer-malloc-leak]: leak of ‘xcalloc(fdisk_label_get_nparttypes(fdisk_get_label(*cf.cxt, 0)) + 1, 32) + i * 32’
# 2027|   				_(fdisk_parttype_get_name(x)));
# 2028|   		else {
# 2029|-> 			name = (char *) _(fdisk_parttype_get_name(x));
# 2030|   			cm[i].desc = fdisk_parttype_get_string(x);
# 2031|   		}

Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
util-linux-2.42.start/disk-utils/cfdisk.c:2030:38: warning[-Wanalyzer-malloc-leak]: leak of ‘xcalloc(fdisk_label_get_nparttypes(fdisk_get_label(*cf.cxt, 0)) + 1, 32) + i * 32’
# 2028|   		else {
# 2029|   			name = (char *) _(fdisk_parttype_get_name(x));
# 2030|-> 			cm[i].desc = fdisk_parttype_get_string(x);
# 2031|   		}
# 2032|   		cm[i].name = name;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def5]
util-linux-2.42.start/disk-utils/cfdisk.c:2182:30: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘xcalloc(fdisk_get_nlabels(*cf.cxt) + 1, 32)’
util-linux-2.42.start/disk-utils/cfdisk.c:267:25: note: in expansion of macro ‘__UL_DBG’
util-linux-2.42.start/disk-utils/cfdisk.c:2170:9: note: in expansion of macro ‘DBG’
# 2180|   		    fdisk_label_get_type(lb) == FDISK_DISKLABEL_BSD)
# 2181|   			continue;
# 2182|-> 		cm[i++].name = fdisk_label_get_name(lb);
# 2183|   	}
# 2184|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def6]
util-linux-2.42.start/include/xalloc.h: scope_hint: In function ‘new_filter’
util-linux-2.42.start/include/xalloc.h:68:13: warning[-Wanalyzer-malloc-leak]: leak of ‘xcalloc(17, 8)’
#   66|   	void *ret = calloc(nelems, size);
#   67|   
#   68|-> 	if (!ret && size && nelems)
#   69|   		err(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size);
#   70|   	return ret;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def7]
util-linux-2.42.start/include/xalloc.h:125:17: warning[-Wanalyzer-malloc-leak]: leak of ‘xcalloc(fdisk_label_get_nparttypes(fdisk_get_label(*cf.cxt, 0)) + 1, 32) + i * 32’
#  123|   	va_end(args);
#  124|   	if (ret < 0)
#  125|-> 		err(XALLOC_EXIT_CODE, "cannot allocate string");
#  126|   	return ret;
#  127|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def8]
util-linux-2.42.start/lsfd-cmd/lsfd.c: scope_hint: In function ‘new_filter’
util-linux-2.42.start/lsfd-cmd/lsfd.c:2373:28: warning[-Wanalyzer-malloc-leak]: leak of ‘xcalloc(ct + 1, 8) + i * 8’
util-linux-2.42.start/lsfd-cmd/lsfd.c:2393:9: note: in expansion of macro ‘list_for_each’
# 2371|   	struct libscols_counter *ct;
# 2372|   
# 2373|-> 	f = new_filter(spec->expr, false, ctl);
# 2374|   
# 2375|   	ct = scols_filter_new_counter(f);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def9]
util-linux-2.42.start/misc-utils/cal.c: scope_hint: In function ‘monthly’
util-linux-2.42.start/misc-utils/cal.c:1099:28: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘xcalloc((long unsigned int)*ctl.months_in_row, 208)’
util-linux-2.42.start/misc-utils/cal.c:79: included_from: Included from here.
# 1097|   
# 1098|   	for (i = 0; i < ctl->months_in_row - 1; i++)
# 1099|-> 		ms[i].next = &ms[i + 1];
# 1100|   
# 1101|   	rows = (ctl->num_months - 1) / ctl->months_in_row;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def10]
util-linux-2.42.start/misc-utils/logger.c:1053:24: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘xmalloc(*ctl.max_message_size + 4) + i’
# 1051|   			c = getchar();
# 1052|   		}
# 1053|-> 		buf[i] = '\0';
# 1054|   
# 1055|   		if (i > 0 || !ctl->skip_empty_lines) {

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

Scan Properties

analyzer-version-clippy1.92.0
analyzer-version-cppcheck2.19.1
analyzer-version-gcc16.0.0
analyzer-version-gcc-analyzer16.0.0
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.92.0
diffbase-analyzer-version-cppcheck2.19.1
diffbase-analyzer-version-gcc16.0.0
diffbase-analyzer-version-gcc-analyzer16.0.0
diffbase-analyzer-version-shellcheck0.11.0
diffbase-analyzer-version-unicontrol0.0.2
diffbase-enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code0
diffbase-hostip-172-16-1-233.us-west-2.compute.internal
diffbase-known-false-positives/usr/share/csmock/known-false-positives.js
diffbase-known-false-positives-rpmknown-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch
diffbase-mock-configfedora-rawhide-x86_64
diffbase-project-nameutil-linux-2.42.start-7.20260109201120024345.pr3952.1130.g823885370
diffbase-store-results-to/tmp/tmp2qlqwxo9/util-linux-2.42.start-7.20260109201120024345.pr3952.1130.g823885370.tar.xz
diffbase-time-created2026-01-09 20:40:10
diffbase-time-finished2026-01-09 20:57:09
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmp2qlqwxo9/util-linux-2.42.start-7.20260109201120024345.pr3952.1130.g823885370.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '/tmp/tmp2qlqwxo9/util-linux-2.42.start-7.20260109201120024345.pr3952.1130.g823885370.src.rpm'
diffbase-tool-versioncsmock-3.8.3.20251215.161544.g62de9a5-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-233.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-x86_64
project-nameutil-linux-2.42.start-7.20260108124223765795.master.1129.g3b373f1c9
store-results-to/tmp/tmpq4wgfm7r/util-linux-2.42.start-7.20260108124223765795.master.1129.g3b373f1c9.tar.xz
time-created2026-01-09 20:20:09
time-finished2026-01-09 20:39:30
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmpq4wgfm7r/util-linux-2.42.start-7.20260108124223765795.master.1129.g3b373f1c9.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '/tmp/tmpq4wgfm7r/util-linux-2.42.start-7.20260108124223765795.master.1129.g3b373f1c9.src.rpm'
tool-versioncsmock-3.8.3.20251215.161544.g62de9a5-1.el9