Newly introduced defects

List of Defects

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1]
util-linux-2.40/misc-utils/uuidgen.c:22: included_from: Included from here.
util-linux-2.40/include/xalloc.h: scope_hint: In function ‘unhex’
util-linux-2.40/include/xalloc.h:33:13: warning[-Wanalyzer-malloc-leak]: leak of ‘xmalloc((*valuelen >> 1) + 1)’
#   31|   	void *ret = malloc(size);
#   32|   
#   33|-> 	if (!ret && size)
#   34|   		err(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size);
#   35|   	return ret;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def2]
util-linux-2.40/misc-utils/hardlink.c: scope_hint: In function ‘get_sorted_xattr_name_table’
util-linux-2.40/misc-utils/hardlink.c:515:26: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘xmalloc((long unsigned int)n * 8)’
util-linux-2.40/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: CLANG_WARNING: [#def3]
util-linux-2.40/misc-utils/lslocks.c:244:7: warning[deadcode.DeadStores]: Although the value stored to 'sz' is used in the enclosing expression, the value is never actually read from 'sz'
#  242|   		return NULL;
#  243|   
#  244|-> 	if ((sz = strlen(path)) >= (sizeof(path) - 2))
#  245|   		goto out;
#  246|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def4]
util-linux-2.40/misc-utils/waitpid.c: scope_hint: In function ‘parse_pids’
util-linux-2.40/misc-utils/waitpid.c:54:25: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘xcalloc(n_strings, 4)’
util-linux-2.40/include/strutils.h:51:64: note: in definition of macro ‘strtopid_or_err’
util-linux-2.40/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-476): [#def5]
util-linux-2.40/misc-utils/waitpid.c: scope_hint: In function ‘open_pidfds’
util-linux-2.40/misc-utils/waitpid.c:64:27: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘xcalloc(n_pids, 4) + i * 4’
util-linux-2.40/include/strutils.h:51:64: note: in definition of macro ‘strtopid_or_err’
util-linux-2.40/misc-utils/waitpid.c:54:55: note: in expansion of macro ‘_’
#   62|   
#   63|   	for (size_t i = 0; i < n_pids; i++) {
#   64|-> 		pidfds[i] = pidfd_open(pids[i], 0);
#   65|   		if (pidfds[i] == -1) {
#   66|   			if (allow_exited && errno == ESRCH) {

Error: CLANG_WARNING: [#def6]
util-linux-2.40/text-utils/more.c:1065:14: warning[core.UndefinedBinaryOperatorResult]: The left operand of '<' is a garbage value
# 1063|   				}
# 1064|   
# 1065|-> 				if ((*sp < ' ' && *sp != '\n') || *sp == CERASE) {
# 1066|   					--ctl->prompt_len;
# 1067|   					erase_one_column(ctl);

Scan Properties

analyzer-version-clang18.1.2
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.2
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-195.us-west-2.compute.internal
diffbase-mock-configfedora-41-x86_64
diffbase-project-nameutil-linux-2.40-0.9.rc1.fc40
diffbase-store-results-to/tmp/tmpike9fc66/util-linux-2.40-0.9.rc1.fc40.tar.xz
diffbase-time-created2024-04-17 06:14:32
diffbase-time-finished2024-04-17 06:28:28
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'shellcheck,clang,cppcheck,gcc' '-o' '/tmp/tmpike9fc66/util-linux-2.40-0.9.rc1.fc40.tar.xz' '--gcc-analyze' '/tmp/tmpike9fc66/util-linux-2.40-0.9.rc1.fc40.src.rpm'
diffbase-tool-versioncsmock-3.5.3-1.el9
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-195.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-nameutil-linux-2.40-13.fc41
store-results-to/tmp/tmpi67z3ech/util-linux-2.40-13.fc41.tar.xz
time-created2024-04-17 06:29:45
time-finished2024-04-17 06:42:35
titleNewly introduced defects
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'shellcheck,clang,cppcheck,gcc' '-o' '/tmp/tmpi67z3ech/util-linux-2.40-13.fc41.tar.xz' '--gcc-analyze' '/tmp/tmpi67z3ech/util-linux-2.40-13.fc41.src.rpm'
tool-versioncsmock-3.5.3-1.el9