Fixed defects

List of Defects

Error: CLANG_WARNING: [#def1]
util-linux-2.40-rc1/misc-utils/lsfd.c:76: included_from: Included from here.
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-rc1/include/list.h:55:20: warning[-Wanalyzer-malloc-leak]: leak of ‘read_devdrv(&line)’
util-linux-2.40-rc1/misc-utils/lsfd.c: scope_hint: In function ‘read_devices’
util-linux-2.40-rc1/misc-utils/lsfd.c:2331:25: note: in expansion of macro ‘INITIALIZE_COLUMNS’
util-linux-2.40-rc1/misc-utils/lsfd.c:2331:25: note: in expansion of macro ‘INITIALIZE_COLUMNS’
util-linux-2.40-rc1/misc-utils/lsfd.c:2331:25: note: in expansion of macro ‘INITIALIZE_COLUMNS’
util-linux-2.40-rc1/include/list.h:39:24: note: in definition of macro ‘INIT_LIST_HEAD’
util-linux-2.40-rc1/misc-utils/lsfd.c: scope_hint: In function ‘read_devices’
util-linux-2.40-rc1/include/list.h:39:24: note: in definition of macro ‘INIT_LIST_HEAD’
util-linux-2.40-rc1/misc-utils/lsfd.c: scope_hint: In function ‘read_devices’
util-linux-2.40-rc1/include/c.h:22: included_from: Included from here.
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: GCC_ANALYZER_WARNING (CWE-476): [#def3]
util-linux-2.40-rc1/misc-utils/blkid.c: scope_hint: In function ‘main’
util-linux-2.40-rc1/misc-utils/blkid.c:859:43: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘xcalloc((long unsigned int)(argc - optind), 8)’
util-linux-2.40-rc1/misc-utils/blkid.c:47: included_from: Included from here.
util-linux-2.40-rc1/misc-utils/blkid.c:17: included_from: Included from here.
#  857|   				continue;
#  858|   
#  859|-> 			devices[numdev++] = dev;
#  860|   		}
#  861|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def4]
util-linux-2.40-rc1/misc-utils/cal.c: scope_hint: In function ‘monthly’
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-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-rc1/misc-utils/hardlink.c: scope_hint: In function ‘get_sorted_xattr_name_table’
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-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-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-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|   

Scan Properties

analyzer-version-clang18.1.3
analyzer-version-cppcheck2.13.0
analyzer-version-gcc14.0.1
analyzer-version-gcc-analyzer14.0.1
analyzer-version-shellcheck0.10.0
diffbase-analyzer-version-clang18.1.3
diffbase-analyzer-version-cppcheck2.13.0
diffbase-analyzer-version-gcc14.0.1
diffbase-analyzer-version-gcc-analyzer14.0.1
diffbase-analyzer-version-shellcheck0.10.0
diffbase-enabled-pluginsclang, cppcheck, gcc, shellcheck
diffbase-exit-code0
diffbase-hostip-172-16-1-215.us-west-2.compute.internal
diffbase-mock-configfedora-41-x86_64
diffbase-project-nameutil-linux-2.40-13.fc41
diffbase-store-results-to/tmp/tmpbzjl2sow/util-linux-2.40-13.fc41.tar.xz
diffbase-time-created2024-04-22 11:27:09
diffbase-time-finished2024-04-22 11:36:31
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpbzjl2sow/util-linux-2.40-13.fc41.tar.xz' '--gcc-analyze' '/tmp/tmpbzjl2sow/util-linux-2.40-13.fc41.src.rpm'
diffbase-tool-versioncsmock-3.5.3-1.el9
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-215.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-nameutil-linux-2.40-0.9.rc1.fc40
store-results-to/tmp/tmpwvfo7ymj/util-linux-2.40-0.9.rc1.fc40.tar.xz
time-created2024-04-22 11:17:40
time-finished2024-04-22 11:26:44
titleFixed defects
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpwvfo7ymj/util-linux-2.40-0.9.rc1.fc40.tar.xz' '--gcc-analyze' '/tmp/tmpwvfo7ymj/util-linux-2.40-0.9.rc1.fc40.src.rpm'
tool-versioncsmock-3.5.3-1.el9