Fixed defects

List of Defects

Error: CLANG_WARNING: [#def1]
util-linux-2.40-build/util-linux-2.40-rc1/misc-utils/lsfd.c:76: included_from: Included from here.
util-linux-2.40-build/util-linux-2.40-rc1/include/list.h:55:13: warning[core.NullDereference]: Access to field 'next' results in a dereference of a null pointer (loaded from variable 'prev')
#   53|   	add->next = next;
#   54|   	add->prev = prev;
#   55|-> 	prev->next = add;
#   56|   }
#   57|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
util-linux-2.40-build/util-linux-2.40-rc1/include/list.h:55:20: warning[-Wanalyzer-malloc-leak]: leak of ‘read_devdrv(&line)’
util-linux-2.40-build/util-linux-2.40-rc1/misc-utils/lsfd.c: scope_hint: In function ‘read_devices’
util-linux-2.40-build/util-linux-2.40-rc1/misc-utils/lsfd.c:2331:25: note: in expansion of macro ‘INITIALIZE_COLUMNS’
util-linux-2.40-build/util-linux-2.40-rc1/misc-utils/lsfd.c:2331:25: note: in expansion of macro ‘INITIALIZE_COLUMNS’
util-linux-2.40-build/util-linux-2.40-rc1/misc-utils/lsfd.c:2331:25: note: in expansion of macro ‘INITIALIZE_COLUMNS’
util-linux-2.40-build/util-linux-2.40-rc1/include/list.h:39:24: note: in definition of macro ‘INIT_LIST_HEAD’
util-linux-2.40-build/util-linux-2.40-rc1/misc-utils/lsfd.c: scope_hint: In function ‘read_devices’
util-linux-2.40-build/util-linux-2.40-rc1/include/list.h:39:24: note: in definition of macro ‘INIT_LIST_HEAD’
util-linux-2.40-build/util-linux-2.40-rc1/misc-utils/lsfd.c: scope_hint: In function ‘read_devices’
util-linux-2.40-build/util-linux-2.40-rc1/include/c.h:22: included_from: Included from here.
util-linux-2.40-build/util-linux-2.40-rc1/misc-utils/lsfd.c:75: included_from: Included from here.
#   53|   	add->next = next;
#   54|   	add->prev = prev;
#   55|-> 	prev->next = add;
#   56|   }
#   57|   

Error: CLANG_WARNING: [#def3]
util-linux-2.40-build/util-linux-2.40-rc1/libmount/src/context_mount.c:553:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'org_type'
#  551|   	org_type  = NULL;
#  552|   
#  553|-> 	if (rc == 0 && try_type && cxt->update) {
#  554|   		struct libmnt_fs *fs = mnt_update_get_fs(cxt->update);
#  555|   		if (fs)

Error: GCC_ANALYZER_WARNING (CWE-476): [#def4]
util-linux-2.40-build/util-linux-2.40-rc1/misc-utils/cal.c: scope_hint: In function ‘monthly’
util-linux-2.40-build/util-linux-2.40-rc1/misc-utils/cal.c:1016:28: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘xcalloc((long unsigned int)*ctl.months_in_row, 208) + (sizetype)i * 208’
util-linux-2.40-build/util-linux-2.40-rc1/misc-utils/cal.c:79: included_from: Included from here.
# 1014|   
# 1015|   	for (i = 0; i < ctl->months_in_row - 1; i++)
# 1016|-> 		ms[i].next = &ms[i + 1];
# 1017|   
# 1018|   	rows = (ctl->num_months - 1) / ctl->months_in_row;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def5]
util-linux-2.40-build/util-linux-2.40-rc1/misc-utils/hardlink.c: scope_hint: In function ‘get_sorted_xattr_name_table’
util-linux-2.40-build/util-linux-2.40-rc1/misc-utils/hardlink.c:515:26: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘xmalloc((long unsigned int)n * 8) + (long unsigned int)i * 8’
util-linux-2.40-build/util-linux-2.40-rc1/misc-utils/hardlink.c: scope_hint: In function ‘get_sorted_xattr_name_table’
#  513|   
#  514|   	for (i = 0; i < n; i++) {
#  515|-> 		table[i] = names;
#  516|   		names += strlen(names) + 1;
#  517|   	}

Error: GCC_ANALYZER_WARNING (CWE-476): [#def6]
util-linux-2.40-build/util-linux-2.40-rc1/misc-utils/lsfd.c:1766:13: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
# 1764|   	       && (isspace((unsigned char)*next) || *next == ','))
# 1765|   		next++;
# 1766|-> 	if (*next != '\0')
# 1767|   		parse_pids(next, pids, count);
# 1768|   }

Error: CLANG_WARNING: [#def7]
util-linux-2.40-build/util-linux-2.40-rc1/misc-utils/lslocks.c:244:7: warning[deadcode.DeadStores]: Although the value stored to 'len' is used in the enclosing expression, the value is never actually read from 'len'
#  242|   		return NULL;
#  243|   
#  244|-> 	if ((len = strlen(path)) >= (sizeof(path) - 2))
#  245|   		goto out;
#  246|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def8]
util-linux-2.40-build/util-linux-2.40-rc1/misc-utils/waitpid.c: scope_hint: In function ‘parse_pids’
util-linux-2.40-build/util-linux-2.40-rc1/misc-utils/waitpid.c:54:25: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘xcalloc(n_strings, 4)’
util-linux-2.40-build/util-linux-2.40-rc1/include/strutils.h:51:64: note: in definition of macro ‘strtopid_or_err’
util-linux-2.40-build/util-linux-2.40-rc1/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-401): [#def9]
util-linux-2.40-build/util-linux-2.40-rc1/sys-utils/hwclock-rtc.c: scope_hint: In function ‘set_param_rtc’
util-linux-2.40-build/util-linux-2.40-rc1/sys-utils/hwclock-rtc.c:418:21: warning[-Wanalyzer-malloc-leak]: leak of ‘xstrdup(opt0)’
util-linux-2.40-build/util-linux-2.40-rc1/sys-utils/hwclock-rtc.c:26: included_from: Included from here.
util-linux-2.40-build/util-linux-2.40-rc1/include/c.h:22: included_from: Included from here.
util-linux-2.40-build/util-linux-2.40-rc1/include/strutils.h:17: included_from: Included from here.
util-linux-2.40-build/util-linux-2.40-rc1/sys-utils/hwclock-rtc.c:25: included_from: Included from here.
util-linux-2.40-build/util-linux-2.40-rc1/sys-utils/hwclock-rtc.c: scope_hint: In function ‘set_param_rtc’
util-linux-2.40-build/util-linux-2.40-rc1/sys-utils/hwclock-rtc.c: scope_hint: In function ‘set_param_rtc’
#  416|   	const struct hwclock_param *param = &hwclock_params[0];
#  417|   
#  418|-> 	while (param->name) {
#  419|   		if (!strcmp(alias, param->name)) {
#  420|   			*value = param->id;

Error: CLANG_WARNING: [#def10]
util-linux-2.40-build/util-linux-2.40-rc1/sys-utils/hwclock-rtc.c:507:3: warning[unix.Malloc]: Potential leak of memory pointed to by 'opt'
#  505|   	rtc_fd = open_rtc(ctl);
#  506|   	if (rtc_fd < 0) {
#  507|-> 		warnx(_("cannot open %s"), rtc_dev_name);
#  508|   		return 1;
#  509|   	}

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-112.us-west-2.compute.internal
diffbase-mock-configfedora-41-x86_64
diffbase-project-nameutil-linux-2.40.1-2.fc41
diffbase-store-results-to/tmp/tmpw5xc8qnb/util-linux-2.40.1-2.fc41.tar.xz
diffbase-time-created2024-07-03 18:26:38
diffbase-time-finished2024-07-03 18:34:24
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpw5xc8qnb/util-linux-2.40.1-2.fc41.tar.xz' '--gcc-analyze' '/tmp/tmpw5xc8qnb/util-linux-2.40.1-2.fc41.src.rpm'
diffbase-tool-versioncsmock-3.5.3-1.el9
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-112.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-nameutil-linux-2.40-0.9.rc1.fc40
store-results-to/tmp/tmp9dxs0qyu/util-linux-2.40-0.9.rc1.fc40.tar.xz
time-created2024-07-03 18:17:56
time-finished2024-07-03 18:25:58
titleFixed defects
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmp9dxs0qyu/util-linux-2.40-0.9.rc1.fc40.tar.xz' '--gcc-analyze' '/tmp/tmp9dxs0qyu/util-linux-2.40-0.9.rc1.fc40.src.rpm'
tool-versioncsmock-3.5.3-1.el9