Fixed findings

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1]
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(ct + 1, 8)’
util-linux-2.42.start/lsfd-cmd/lsfd.c:50: included_from: Included from here.
util-linux-2.42.start/lsfd-cmd/lsfd.c:2393:9: note: in expansion of macro ‘list_for_each’
#   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: COMPILER_WARNING: [#def2]
util-linux-2.42.start/libsmartcols/src/filter-parser.c: scope_hint: In function 'yyparse'
util-linux-2.42.start/libsmartcols/src/filter-parser.c:1177:9: warning[-Wunused-but-set-variable=]: variable 'yynerrs' set but not used
# 1177 |     int yynerrs = 0;
#      |         ^~~~~~~
# 1175|   
# 1176|       /* Number of syntax errors so far.  */
# 1177|->     int yynerrs = 0;
# 1178|   
# 1179|       yy_state_fast_t yystate = 0;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def3]
util-linux-2.42.start/login-utils/setpwnam.c: scope_hint: In function ‘setpwnam’
util-linux-2.42.start/login-utils/setpwnam.c:101:29: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen("/etc/passwd", "r")’
util-linux-2.42.start/login-utils/setpwnam.c:62: included_from: Included from here.
#   99|   		goto fail;
#  100|   
#  101|-> 	namelen = strlen(pwd->pw_name);
#  102|   	if (namelen > buflen)
#  103|   		buflen += namelen;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
util-linux-2.42.start/login-utils/setpwnam.c:101:29: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen("/etc/passwd", "r")’
#   99|   		goto fail;
#  100|   
#  101|-> 	namelen = strlen(pwd->pw_name);
#  102|   	if (namelen > buflen)
#  103|   		buflen += namelen;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def5]
util-linux-2.42.start/login-utils/setpwnam.c:136:29: warning[-Wanalyzer-malloc-leak]: leak of ‘linebuf’
#  134|   			/* Yes! But this time let’s not walk past the end of the buffer
#  135|   			 * in the name of the Lord, SUID, or anything else. */
#  136|-> 			if (putpwent(pwd, fp) < 0)
#  137|   				goto fail;
#  138|   			found = 1;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def6]
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) + (sizetype)i * 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): [#def7]
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): [#def8]
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)’
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;

Error: COMPILER_WARNING: [#def9]
util-linux-2.42.start/sys-utils/hwclock-parse-date.c: scope_hint: In function ‘yyparse’
util-linux-2.42.start/sys-utils/hwclock-parse-date.c:1338:9: warning[-Wunused-but-set-variable=]: variable ‘yynerrs’ set but not used
# 1338 |     int yynerrs = 0;
#      |         ^~~~~~~
# 1336|   
# 1337|       /* Number of syntax errors so far.  */
# 1338|->     int yynerrs = 0;
# 1339|   
# 1340|       yy_state_fast_t yystate = 0;

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-44.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.20260106161439348816.pr3929.1110.g3c78ef285
diffbase-store-results-to/tmp/tmpb1vhfn05/util-linux-2.42.start-7.20260106161439348816.pr3929.1110.g3c78ef285.tar.xz
diffbase-time-created2026-01-06 16:53:46
diffbase-time-finished2026-01-06 17:12:39
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'cppcheck,unicontrol,gcc,shellcheck,clippy' '-o' '/tmp/tmpb1vhfn05/util-linux-2.42.start-7.20260106161439348816.pr3929.1110.g3c78ef285.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '/tmp/tmpb1vhfn05/util-linux-2.42.start-7.20260106161439348816.pr3929.1110.g3c78ef285.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-44.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.20260105114933061167.master.1090.g04e45703a
store-results-to/tmp/tmpvlpfpuy8/util-linux-2.42.start-7.20260105114933061167.master.1090.g04e45703a.tar.xz
time-created2026-01-06 16:33:51
time-finished2026-01-06 16:53:12
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'cppcheck,unicontrol,gcc,shellcheck,clippy' '-o' '/tmp/tmpvlpfpuy8/util-linux-2.42.start-7.20260105114933061167.master.1090.g04e45703a.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '/tmp/tmpvlpfpuy8/util-linux-2.42.start-7.20260105114933061167.master.1090.g04e45703a.src.rpm'
tool-versioncsmock-3.8.3.20251215.161544.g62de9a5-1.el9