numactl-2.0.19-1.fc42

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1]
numactl-2.0.19-build/numactl-2.0.19/libnuma.c: scope_hint: In function ‘numa_find_first’
numactl-2.0.19-build/numactl-2.0.19/libnuma.c:137:29: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘mask’
numactl-2.0.19-build/numactl-2.0.19/libnuma.c:27: included_from: Included from here.
#  135|   {
#  136|   	int i;
#  137|-> 	for (i = 0; i < mask->size; i++)
#  138|   		if (numa_bitmask_isbitset(mask, i))
#  139|   			return i;

Error: CPPCHECK_WARNING (CWE-401): [#def2]
numactl-2.0.19-build/numactl-2.0.19/libnuma.c:430: error[memleakOnRealloc]: Common realloc mistake: 'mask' nulled but not freed upon failure
#  428|   		do {
#  429|   			nodemask_sz <<= 1;
#  430|-> 			mask = realloc(mask, nodemask_sz / 8 + sizeof(unsigned long));
#  431|   			if (!mask)
#  432|   				return;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def3]
numactl-2.0.19-build/numactl-2.0.19/libnuma.c: scope_hint: In function ‘numa_has_home_node’
numactl-2.0.19-build/numactl-2.0.19/libnuma.c:703:16: warning[-Wanalyzer-malloc-leak]: leak of ‘numa_get_mems_allowed()’
#  701|   numa_num_possible_nodes(void)
#  702|   {
#  703|-> 	return nodemask_sz;
#  704|   }
#  705|   

Error: CPPCHECK_WARNING (CWE-758): [#def4]
numactl-2.0.19-build/numactl-2.0.19/numademo.c:138: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior
#  136|   	for (i = 0; i < nmemb; i++) {
#  137|   		union node *n = &nodes[i];
#  138|-> 		n->next = n->nexti >= nmemb ? NULL : &nodes[n->nexti];
#  139|   	}
#  140|   	return (void **)nodes;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def5]
numactl-2.0.19-build/numactl-2.0.19/numastat.c: scope_hint: In function ‘show_info_from_system_file’
numactl-2.0.19-build/numactl-2.0.19/numastat.c:858:57: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(&fname, "r")’
numactl-2.0.19-build/numactl-2.0.19/numastat.c: scope_hint: In function ‘show_info_from_system_file’
#  856|                           // example line from meminfo  file: "Node 3 Inactive:  210680 kB"
#  857|                           if (node_ix == 0) {
#  858|->                                 char *token = strdup(tok[0 + tok_offset]);
#  859|                                   if (token == NULL) {
#  860|                                           perror("malloc failed line: " STRINGIFY(__LINE__));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def6]
numactl-2.0.19-build/numactl-2.0.19/numastat.c:858:57: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(&fname, "r")’
numactl-2.0.19-build/numactl-2.0.19/numastat.c: scope_hint: In function ‘show_info_from_system_file’
#  856|                           // example line from meminfo  file: "Node 3 Inactive:  210680 kB"
#  857|                           if (node_ix == 0) {
#  858|->                                 char *token = strdup(tok[0 + tok_offset]);
#  859|                                   if (token == NULL) {
#  860|                                           perror("malloc failed line: " STRINGIFY(__LINE__));

Error: GCC_ANALYZER_WARNING (CWE-775): [#def7]
numactl-2.0.19-build/numactl-2.0.19/shm.c: scope_hint: In function ‘sysvkey’
numactl-2.0.19-build/numactl-2.0.19/shm.c:91:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘creat(name,  shmmode)’
#   89|   		name, shmmode);
#   90|   	fd = creat(name, shmmode);
#   91|-> 	if (fd < 0)
#   92|   		nerror("cannot create key for shm %s\n", name);
#   93|   	key = ftok(name, shmid);

Error: GCC_ANALYZER_WARNING: [#def8]
numactl-2.0.19-build/numactl-2.0.19/sysfs.c: scope_hint: In function ‘sysfs_read’
numactl-2.0.19-build/numactl-2.0.19/sysfs.c:24:13: warning[-Wanalyzer-fd-use-without-check]: ‘read’ on possibly invalid file descriptor ‘open(name, 0)’
#   22|   		return NULL;
#   23|   	fd = open(name, O_RDONLY);
#   24|-> 	n = read(fd, buf, SYSFS_BLOCK - 1);
#   25|   	close(fd);
#   26|   	if (n <= 0) {

Scan Properties

analyzer-version-clippy1.82.0
analyzer-version-cppcheck2.16.0
analyzer-version-gcc14.2.1
analyzer-version-gcc-analyzer15.0.0
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-206.us-west-2.compute.internal
mock-configfedora-rawhide-gcc-latest-x86_64
project-namenumactl-2.0.19-1.fc42
store-results-to/tmp/tmp4y7mnej6/numactl-2.0.19-1.fc42.tar.xz
time-created2024-11-13 02:10:53
time-finished2024-11-13 02:12:17
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmp4y7mnej6/numactl-2.0.19-1.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmp4y7mnej6/numactl-2.0.19-1.fc42.src.rpm'
tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9