libnvme-1.13-1.fc43

List of Findings

Error: CPPCHECK_WARNING (CWE-476): [#def1]
libnvme-1.13/examples/telemetry-listen.c:157: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: e
#  155|   					continue;
#  156|   				FD_SET(fd, &fds);
#  157|-> 				e[i].uevent_fd = fd;
#  158|   				e[i].c = c;
#  159|   				i++;

Error: CPPCHECK_WARNING (CWE-476): [#def2]
libnvme-1.13/examples/telemetry-listen.c:158: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: e
#  156|   				FD_SET(fd, &fds);
#  157|   				e[i].uevent_fd = fd;
#  158|-> 				e[i].c = c;
#  159|   				i++;
#  160|   			}

Error: GCC_ANALYZER_WARNING (CWE-476): [#def3]
libnvme-1.13/redhat-linux-build/../examples/telemetry-listen.c:157:33: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘e’
libnvme-1.13/redhat-linux-build/../examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.13/redhat-linux-build/../examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../examples/telemetry-listen.c:145:13: acquire_memory: this call could return NULL
libnvme-1.13/redhat-linux-build/../examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.13/redhat-linux-build/../examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.13/redhat-linux-build/../examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.13/redhat-linux-build/../examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.13/redhat-linux-build/../examples/telemetry-listen.c:150:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.13/redhat-linux-build/../examples/telemetry-listen.c:151:25: branch_true: ...to here
libnvme-1.13/redhat-linux-build/../examples/telemetry-listen.c:151:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.13/redhat-linux-build/../examples/telemetry-listen.c:152:42: branch_true: ...to here
libnvme-1.13/redhat-linux-build/../examples/telemetry-listen.c:152:42: call_function: calling ‘open_uevent’ from ‘main’
libnvme-1.13/redhat-linux-build/../examples/telemetry-listen.c:152:42: return_function: returning to ‘main’ from ‘open_uevent’
libnvme-1.13/redhat-linux-build/../examples/telemetry-listen.c:154:36: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../examples/telemetry-listen.c:156:33: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../examples/telemetry-listen.c:157:33: danger: ‘e + (long unsigned int)i * 16’ could be NULL: unchecked value from [(4)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/3)
#  155|   					continue;
#  156|   				FD_SET(fd, &fds);
#  157|-> 				e[i].uevent_fd = fd;
#  158|   				e[i].c = c;
#  159|   				i++;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:724:12: warning[-Wanalyzer-malloc-leak]: leak of ‘*((struct nvme_root *)r).options’
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1004:13: enter_function: entry to ‘nvmf_connect_disc_entry’
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1054:21: call_function: calling ‘nvmf_trtype_str’ from ‘nvmf_connect_disc_entry’
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1054:21: return_function: returning to ‘nvmf_connect_disc_entry’ from ‘nvmf_trtype_str’
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1061:12: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1069:17: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1092:12: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1098:13: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1098:12: branch_true: following ‘true’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1099:13: branch_true: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1099:13: call_function: calling ‘__nvmf_supported_options’ from ‘nvmf_connect_disc_entry’
#  722|   
#  723|   	r->options = calloc(1, sizeof(*r->options));
#  724|-> 	if (!r->options)
#  725|   		return -ENOMEM;
#  726|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def5]
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1335:21: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(&filename, 0)’
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1326:12: branch_false: following ‘false’ branch...
 branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1328:16: branch_true: following ‘true’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1332:21: branch_true: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1332:20: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1334:62: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1335:21: acquire_resource: opened here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1335:21: danger: ‘open(&filename, 0)’ leaks here; was opened at [(7)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/6)
# 1333|   			continue;
# 1334|   		sprintf(filename, "%s/%s/type", entries_dir, de->d_name);
# 1335|-> 		f = open(filename, O_RDONLY);
# 1336|   		if (f < 0)
# 1337|   			continue;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def6]
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1338:23: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(&filename, 0)’
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1326:12: branch_false: following ‘false’ branch...
 branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1328:16: branch_true: following ‘true’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1332:21: branch_true: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1332:20: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1334:62: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1335:21: acquire_resource: opened here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1336:20: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1338:23: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1338:23: danger: ‘open(&filename, 0)’ leaks here; was opened at [(7)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/6)
# 1336|   		if (f < 0)
# 1337|   			continue;
# 1338|-> 		len = read(f, buf, 512);
# 1339|   		close(f);
# 1340|   		if (len <= 0)

Error: GCC_ANALYZER_WARNING (CWE-775): [#def7]
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1347:21: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(&filename, 0)’
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1326:12: branch_false: following ‘false’ branch...
 branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1328:16: branch_true: following ‘true’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1332:21: branch_true: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1347:21: acquire_resource: opened here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1347:21: danger: ‘open(&filename, 0)’ leaks here; was opened at [(5)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/4)
# 1345|   			continue;
# 1346|   		sprintf(filename, "%s/%s/raw", entries_dir, de->d_name);
# 1347|-> 		f = open(filename, O_RDONLY);
# 1348|   		if (f < 0)
# 1349|   			continue;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def8]
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1350:23: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(&filename, 0)’
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1326:12: branch_false: following ‘false’ branch...
 branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1328:16: branch_true: following ‘true’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1332:21: branch_true: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1347:21: acquire_resource: opened here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1350:23: danger: ‘open(&filename, 0)’ leaks here; was opened at [(5)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/4)
# 1348|   		if (f < 0)
# 1349|   			continue;
# 1350|-> 		len = read(f, buf, 512);
# 1351|   		close(f);
# 1352|   		if (len <= 0)

Error: GCC_ANALYZER_WARNING (CWE-775): [#def9]
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1391:18: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen("/sys/class/dmi/id/product_uuid", "re")’
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1391:18: acquire_resource: opened here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1391:18: danger: ‘fopen("/sys/class/dmi/id/product_uuid", "re")’ leaks here; was opened at [(1)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/0)
# 1389|   	size_t len = 0;
# 1390|   
# 1391|-> 	stream = fopen(PATH_DMI_PROD_UUID, "re");
# 1392|   	if (!stream)
# 1393|   		return -ENXIO;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def10]
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1391:18: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen("/sys/class/dmi/id/product_uuid", "re")’
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1391:18: acquire_memory: allocated here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1391:18: danger: ‘fopen("/sys/class/dmi/id/product_uuid", "re")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/0)
# 1389|   	size_t len = 0;
# 1390|   
# 1391|-> 	stream = fopen(PATH_DMI_PROD_UUID, "re");
# 1392|   	if (!stream)
# 1393|   		return -ENXIO;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def11]
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1795:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘*c.dctype’ where non-null expected
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1789:6: enter_function: entry to ‘nvmf_is_registration_supported’
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1792:21: call_function: calling ‘nvme_fetch_cntrltype_dctype_from_id’ from ‘nvmf_is_registration_supported’
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1792:21: return_function: returning to ‘nvmf_is_registration_supported’ from ‘nvme_fetch_cntrltype_dctype_from_id’
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1792:20: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1795:24: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1795:17: danger: argument 1 (‘*c.dctype’) from [(12)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/11) could be NULL where non-null expected
# 1793|   			return false;
# 1794|   
# 1795|-> 	return !strcmp(c->dctype, "ddc") || !strcmp(c->dctype, "cdc");
# 1796|   }
# 1797|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def12]
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1827:22: warning[-Wanalyzer-malloc-leak]: leak of ‘unescape_uri(elem, 0)’
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1841:26: enter_function: entry to ‘nvme_parse_uri’
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1865:12: branch_false: following ‘false’ branch (when ‘uri’ is non-NULL)...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1868:13: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1868:12: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1875:13: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1875:12: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1883:16: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1891:12: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1904:13: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1904:12: branch_true: following ‘true’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1908:21: branch_true: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1909:20: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1914:21: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1915:20: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1921:29: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1928:20: branch_true: following ‘true’ branch (when ‘elem’ is non-NULL)...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1929:25: branch_true: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1929:51: call_function: calling ‘unescape_uri’ from ‘nvme_parse_uri’
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1929:51: return_function: returning to ‘nvme_parse_uri’ from ‘unescape_uri’
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1827:22: danger: ‘unescape_uri(elem, 0)’ leaks here; was allocated at [(22)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/21)
# 1825|   
# 1826|   	l = len > 0 ? len : strlen(str);
# 1827|-> 	dst = malloc(l + 1);
# 1828|   	for (i = 0, j = 0; i < l; i++, j++) {
# 1829|   		if (str[i] == '%' && i + 2 < l &&

Error: GCC_ANALYZER_WARNING (CWE-476): [#def13]
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1831:25: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘dst’
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1826:9: branch_false: following ‘false’ branch (when ‘len > 0’)...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1827:22: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1827:15: acquire_memory: this call could return NULL
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1828:28: branch_true: following ‘true’ branch (when ‘l > i’)...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1829:24: branch_true: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1829:20: branch_true: following ‘true’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1831:25: danger: ‘dst + (sizetype)j’ could be NULL: unchecked value from [(3)](sarif:/runs/0/results/11/codeFlows/0/threadFlows/0/locations/2)
# 1829|   		if (str[i] == '%' && i + 2 < l &&
# 1830|   		    IS_XDIGIT(str[i + 1]) && IS_XDIGIT(str[i + 2])) {
# 1831|-> 			dst[j] = (XDIGIT_VAL(str[i + 1]) << 4) +
# 1832|   				  XDIGIT_VAL(str[i + 2]);
# 1833|   			i += 2;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def14]
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1835:25: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘dst’
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1826:9: branch_false: following ‘false’ branch (when ‘len > 0’)...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1827:22: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1827:15: acquire_memory: this call could return NULL
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1828:28: branch_true: following ‘true’ branch (when ‘l > i’)...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1829:24: branch_true: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1835:25: danger: ‘dst + (sizetype)j’ could be NULL: unchecked value from [(3)](sarif:/runs/0/results/12/codeFlows/0/threadFlows/0/locations/2)
# 1833|   			i += 2;
# 1834|   		} else
# 1835|-> 			dst[j] = str[i];
# 1836|   	}
# 1837|   	dst[j] = '\0';

Error: GCC_ANALYZER_WARNING (CWE-476): [#def15]
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1837:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘dst’
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1826:9: branch_true: following ‘true’ branch (when ‘len <= 0’)...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1826:29: branch_true: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1827:15: acquire_memory: this call could return NULL
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1828:28: branch_false: following ‘false’ branch (when ‘l <= i’)...
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1837:12: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/fabrics.c:1837:9: danger: ‘dst + (sizetype)j’ could be NULL: unchecked value from [(3)](sarif:/runs/0/results/13/codeFlows/0/threadFlows/0/locations/2)
# 1835|   			dst[j] = str[i];
# 1836|   	}
# 1837|-> 	dst[j] = '\0';
# 1838|   	return dst;
# 1839|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def16]
libnvme-1.13/redhat-linux-build/../src/nvme/linux.c:1657:13: warning[-Wanalyzer-malloc-leak]: leak of ‘nvme_import_tls_key_versioned(key, & version, & hmac, & key_len)’
libnvme-1.13/redhat-linux-build/../src/nvme/linux.c:1375:13: enter_function: entry to ‘__nvme_insert_tls_key’
libnvme-1.13/redhat-linux-build/../src/nvme/linux.c:1384:20: call_function: calling ‘nvme_import_tls_key_versioned’ from ‘__nvme_insert_tls_key’
libnvme-1.13/redhat-linux-build/../src/nvme/linux.c:1384:20: return_function: returning to ‘__nvme_insert_tls_key’ from ‘nvme_import_tls_key_versioned’
libnvme-1.13/redhat-linux-build/../src/nvme/linux.c:1657:13: danger: ‘nvme_import_tls_key_versioned(key, & version, & hmac, & key_len)’ leaks here; was allocated at [(16)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/15)
# 1655|   	}
# 1656|   
# 1657|-> 	if (_version != 1) {
# 1658|   		errno = EINVAL;
# 1659|   		return NULL;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def17]
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:478:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘d’
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:753:13: call_function: calling ‘parse_raw_nbft’ from ‘nvme_nbft_read’
#  476|   			 nbft->filename, discovery->index);
#  477|   
#  478|-> 	*d = discovery;
#  479|   	r = 0;
#  480|   

Error: GCC_ANALYZER_WARNING (CWE-131): [#def18]
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:511:9: warning[-Wanalyzer-allocation-size]: allocated buffer size is not a multiple of the pointee's size
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/nbft.c:753:13: call_function: calling ‘parse_raw_nbft’ from ‘nvme_nbft_read’
#  509|   	int i, cnt;
#  510|   
#  511|-> 	nbft->security_list = calloc(num_sec + 1, sizeof(struct nbft_info_security));
#  512|   	for (i = 0, cnt = 0; i < num_sec; i++) {
#  513|   		if (read_security(nbft, &raw_sec_array[i], &nbft->security_list[cnt]) == 0)

Error: GCC_ANALYZER_WARNING (CWE-688): [#def19]
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:794:22: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘*s.subsysnqn’ where non-null expected
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2191:13: enter_function: entry to ‘nvme_scan_ctrl’
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2203:12: branch_false: following ‘false’ branch (when ‘ret >= 0’)...
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2208:19: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2210:13: call_function: calling ‘nvme_lookup_host’ from ‘nvme_scan_ctrl’
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2210:13: return_function: returning to ‘nvme_scan_ctrl’ from ‘nvme_lookup_host’
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2211:12: branch_true: following ‘true’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2212:21: branch_true: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2229:12: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2233:22: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2233:22: call_function: calling ‘nvme_ctrl_lookup_subsystem_name’ from ‘nvme_scan_ctrl’
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2233:22: return_function: returning to ‘nvme_scan_ctrl’ from ‘nvme_ctrl_lookup_subsystem_name’
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2234:12: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2241:13: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2241:13: call_function: calling ‘nvme_lookup_subsystem’ from ‘nvme_scan_ctrl’
#  792|   	s->subsystype = nvme_get_attr(path, "subsystype");
#  793|   	if (!s->subsystype) {
#  794|-> 		if (!strcmp(s->subsysnqn, NVME_DISC_SUBSYS_NAME))
#  795|   			s->subsystype = strdup("discovery");
#  796|   		else

Error: GCC_ANALYZER_WARNING (CWE-476): [#def20]
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:1860:13: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘r’
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2258:6: enter_function: entry to ‘nvme_rescan_ctrl’
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2260:25: branch_true: following ‘true’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2260:33: branch_true: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2260:25: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2261:12: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2261:12: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2263:9: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2263:9: call_function: calling ‘nvme_ctrl_scan_namespaces’ from ‘nvme_rescan_ctrl’
# 1858|   	int i;
# 1859|   
# 1860|-> 	if (r->create_only) {
# 1861|   		nvme_msg(r, LOG_DEBUG, "skipping namespace scan for ctrl %s\n",
# 1862|   			 c->name);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def21]
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:1882:25: warning[-Wanalyzer-malloc-leak]: leak of ‘nvme_ctrl_lookup_subsystem_name(r,  name)’
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2191:13: enter_function: entry to ‘nvme_scan_ctrl’
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2203:12: branch_false: following ‘false’ branch (when ‘ret >= 0’)...
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2208:19: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2210:13: call_function: calling ‘nvme_lookup_host’ from ‘nvme_scan_ctrl’
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2210:13: return_function: returning to ‘nvme_scan_ctrl’ from ‘nvme_lookup_host’
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2211:12: branch_true: following ‘true’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2212:21: branch_true: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2229:12: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2233:22: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2233:22: call_function: calling ‘nvme_ctrl_lookup_subsystem_name’ from ‘nvme_scan_ctrl’
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2233:22: return_function: returning to ‘nvme_scan_ctrl’ from ‘nvme_ctrl_lookup_subsystem_name’
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:1882:25: danger: ‘nvme_ctrl_lookup_subsystem_name(r,  name)’ leaks here; was allocated at [(29)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/28)
# 1880|   	if (subsys.num < 0)
# 1881|   		return NULL;
# 1882|-> 	for (i = 0; i < subsys.num; i++) {
# 1883|   		struct stat st;
# 1884|   		_cleanup_free_ char *path = NULL;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def22]
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2299:12: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2258:6: enter_function: entry to ‘nvme_rescan_ctrl’
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2260:25: branch_true: following ‘true’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2261:12: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2263:9: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2263:9: call_function: calling ‘nvme_ctrl_scan_namespaces’ from ‘nvme_rescan_ctrl’
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2263:9: return_function: returning to ‘nvme_rescan_ctrl’ from ‘nvme_ctrl_scan_namespaces’
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2264:9: call_function: calling ‘nvme_ctrl_scan_paths’ from ‘nvme_rescan_ctrl’
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2264:9: return_function: returning to ‘nvme_rescan_ctrl’ from ‘nvme_ctrl_scan_paths’
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2265:9: call_function: calling ‘nvme_subsystem_scan_namespaces’ from ‘nvme_rescan_ctrl’
# 2297|   void nvme_ns_release_fd(nvme_ns_t n)
# 2298|   {
# 2299|-> 	if (n->fd < 0)
# 2300|   		return;
# 2301|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def23]
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2656:50: warning[-Wanalyzer-malloc-leak]: leak of ‘nvme_ns_open(path,  nvme_ns_generic_to_blkdev(name))’
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2258:6: enter_function: entry to ‘nvme_rescan_ctrl’
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2260:25: branch_true: following ‘true’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2261:12: branch_false: following ‘false’ branch...
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2263:9: branch_false: ...to here
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2263:9: call_function: calling ‘nvme_ctrl_scan_namespaces’ from ‘nvme_rescan_ctrl’
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2263:9: return_function: returning to ‘nvme_rescan_ctrl’ from ‘nvme_ctrl_scan_namespaces’
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2264:9: call_function: calling ‘nvme_ctrl_scan_paths’ from ‘nvme_rescan_ctrl’
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2264:9: return_function: returning to ‘nvme_rescan_ctrl’ from ‘nvme_ctrl_scan_paths’
libnvme-1.13/redhat-linux-build/../src/nvme/tree.c:2265:9: call_function: calling ‘nvme_subsystem_scan_namespaces’ from ‘nvme_rescan_ctrl’
# 2654|   
# 2655|   	for (i = 0; i < size; i++) {
# 2656|-> 		struct sysfs_attr_table *e = &tbl[i];
# 2657|   
# 2658|   		str = nvme_get_attr(path, e->name);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def24]
libnvme-1.13/redhat-linux-build/../test/mock-ifaddrs.c:38:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘storage’
libnvme-1.13/redhat-linux-build/../test/mock-ifaddrs.c:107:45: acquire_memory: this call could return NULL
libnvme-1.13/redhat-linux-build/../test/mock-ifaddrs.c:110:9: call_function: inlined call to ‘init_entry’ from ‘getifaddrs’
#   36|   
#   37|   	p = &storage->ifa;
#   38|-> 	p->ifa_next = last ? NULL : &storage[1].ifa;
#   39|   	p->ifa_name = storage->name;
#   40|   	strcpy(p->ifa_name, ifname);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def25]
libnvme-1.13/redhat-linux-build/../test/mock-ifaddrs.c:117:16: warning[-Wanalyzer-malloc-leak]: leak of ‘storage’
/usr/include/ifaddrs.h:66:12: enter_function: entry to ‘getifaddrs’
libnvme-1.13/redhat-linux-build/../test/mock-ifaddrs.c:107:45: acquire_memory: allocated here
libnvme-1.13/redhat-linux-build/../test/mock-ifaddrs.c:110:9: call_function: inlined call to ‘init_entry’ from ‘getifaddrs’
libnvme-1.13/redhat-linux-build/../test/mock-ifaddrs.c:111:9: call_function: calling ‘init_entry’ from ‘getifaddrs’
libnvme-1.13/redhat-linux-build/../test/mock-ifaddrs.c:111:9: return_function: returning to ‘getifaddrs’ from ‘init_entry’
libnvme-1.13/redhat-linux-build/../test/mock-ifaddrs.c:115:9: call_function: calling ‘init_entry’ from ‘getifaddrs’
libnvme-1.13/redhat-linux-build/../test/mock-ifaddrs.c:115:9: return_function: returning to ‘getifaddrs’ from ‘init_entry’
libnvme-1.13/redhat-linux-build/../test/mock-ifaddrs.c:117:16: danger: ‘storage’ leaks here; was allocated at [(2)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/1)
#  115|   	init_entry(&storage[3], "lo", AF_INET6, 0, 0, 0, 1, true); /* ::1 */
#  116|   
#  117|-> 	return 0;
#  118|   }
#  119|   

Error: CPPCHECK_WARNING (CWE-457): [#def26]
libnvme-1.13/redhat-linux-build/libnvme/nvme_wrap.c:784: warning[uninitvar]: Uninitialized variable: buff
#  782|       *r = 0;
#  783|     }
#  784|->   return buff;
#  785|   }
#  786|   

Error: CPPCHECK_WARNING (CWE-476): [#def27]
libnvme-1.13/redhat-linux-build/libnvme/nvme_wrap.c:1680: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: data
# 1678|       SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData));
# 1679|       /* the klass element */
# 1680|->     data->klass = obj;
# 1681|       SWIG_Py_INCREF(data->klass);
# 1682|       /* the newraw method and newargs arguments used to create a new raw instance */

Error: CPPCHECK_WARNING (CWE-476): [#def28]
libnvme-1.13/redhat-linux-build/libnvme/nvme_wrap.c:1681: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: data
# 1679|       /* the klass element */
# 1680|       data->klass = obj;
# 1681|->     SWIG_Py_INCREF(data->klass);
# 1682|       /* the newraw method and newargs arguments used to create a new raw instance */
# 1683|       if (PyClass_Check(obj)) {

Error: CPPCHECK_WARNING (CWE-476): [#def29]
libnvme-1.13/src/nvme/fabrics.c:1837: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dst
# 1835|   			dst[j] = str[i];
# 1836|   	}
# 1837|-> 	dst[j] = '\0';
# 1838|   	return dst;
# 1839|   }

Error: CPPCHECK_WARNING (CWE-758): [#def30]
libnvme-1.13/src/nvme/ioctl.c:2028: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 2026|   		((args->prinfor & 0xf) << 12) | ((args->dtype & 0xf) << 20) |
# 2027|   		((args->prinfow & 0xf) << 26) | ((args->fua & 0x1) << 30) |
# 2028|-> 		((args->lr & 0x1) << 31);
# 2029|   
# 2030|   	if (args->args_size == size_v1) {

Error: CPPCHECK_WARNING (CWE-476): [#def31]
libnvme-1.13/src/nvme/json.c:34: error[nullPointer]: Null pointer dereference
#   32|   
#   33|   	json_object_object_foreach(ctrl_obj, key_str, val_obj) {
#   34|-> 		JSON_UPDATE_INT_OPTION(cfg, key_str,
#   35|   				       nr_io_queues, val_obj);
#   36|   		JSON_UPDATE_INT_OPTION(cfg, key_str,

Error: CPPCHECK_WARNING (CWE-476): [#def32]
libnvme-1.13/src/nvme/json.c:34: error[nullPointer]: Null pointer dereference: key_str
#   32|   
#   33|   	json_object_object_foreach(ctrl_obj, key_str, val_obj) {
#   34|-> 		JSON_UPDATE_INT_OPTION(cfg, key_str,
#   35|   				       nr_io_queues, val_obj);
#   36|   		JSON_UPDATE_INT_OPTION(cfg, key_str,

Error: CPPCHECK_WARNING (CWE-401): [#def33]
libnvme-1.13/src/nvme/linux.c:1318: error[memleak]: Memory leak: identity
# 1316|   	if (!psk) {
# 1317|   		errno = ENOMEM;
# 1318|-> 		return 0;
# 1319|   	}
# 1320|   	memset(psk, 0, key_len);

Error: CPPCHECK_WARNING (CWE-758): [#def34]
libnvme-1.13/src/nvme/mi.c:1770: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 1768|   		(NVME_MI_MT_MI << 3);
# 1769|   	req_hdr.opcode = nvme_mi_mi_opcode_subsys_health_status_poll;
# 1770|-> 	req_hdr.cdw1 = (clear ? 1 : 0) << 31;
# 1771|   
# 1772|   	memset(&req, 0, sizeof(req));

Error: CPPCHECK_WARNING (CWE-758): [#def35]
libnvme-1.13/src/nvme/types.h:1735: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 1733|   	NVME_CTRL_OAES_ANSAN		= NVME_VAL(CTRL_OAES_ANSAN),
# 1734|   	NVME_CTRL_OAES_ZD		= NVME_VAL(CTRL_OAES_ZD),
# 1735|-> 	NVME_CTRL_OAES_DL		= NVME_VAL(CTRL_OAES_DL),
# 1736|   };
# 1737|   

Error: CPPCHECK_WARNING (CWE-758): [#def36]
libnvme-1.13/src/nvme/types.h:9391: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 9389|   	NVME_FEATURE_AENCFG_NOTICE_LBA_STATUS			= 1 << 13,
# 9390|   	NVME_FEATURE_AENCFG_NOTICE_EG_EVENT			= 1 << 14,
# 9391|-> 	NVME_FEATURE_AENCFG_NOTICE_DISCOVERY_CHANGE		= 1 << 31,
# 9392|   };
# 9393|   

Error: CPPCHECK_WARNING (CWE-758): [#def37]
libnvme-1.13/src/nvme/types.h:9980: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 9978|   
# 9979|   	/* Migration Send - Suspend */
# 9980|-> 	NVME_LM_DUDMQ					= 1 << 31,
# 9981|   	NVME_LM_STYPE_SHIFT				= 16,
# 9982|   	NVME_LM_STYPE_MASK				= 0xff,

Error: CPPCHECK_WARNING (CWE-404): [#def38]
libnvme-1.13/src/nvme/util.c:792: error[resourceLeak]: Resource leak: file
#  790|   
#  791|   	if (!p)
#  792|-> 		return 0;
#  793|   
#  794|   	 /* Strip unwanted trailing chars */

Error: CPPCHECK_WARNING (CWE-404): [#def39]
libnvme-1.13/src/nvme/util.c:798: error[resourceLeak]: Resource leak: file
#  796|   	*bufsz -= len;
#  797|   
#  798|-> 	return len;
#  799|   }
#  800|   

Error: CPPCHECK_WARNING (CWE-562): [#def40]
libnvme-1.13/test/mi-mctp.c:519: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  517|   
#  518|   	peer->tx_fn = tx_mpr;
#  519|-> 	peer->tx_data = &tx_info;
#  520|   
#  521|   	rc = nvme_mi_mi_read_mi_data_subsys(ep, &ss_info);

Error: CPPCHECK_WARNING (CWE-562): [#def41]
libnvme-1.13/test/mi-mctp.c:537: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  535|   
#  536|   	peer->tx_fn = tx_mpr;
#  537|-> 	peer->tx_data = &tx_info;
#  538|   
#  539|   	ctrl = nvme_mi_init_ctrl(ep, 1);

Error: CPPCHECK_WARNING (CWE-562): [#def42]
libnvme-1.13/test/mi-mctp.c:562: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  560|   
#  561|   	peer->tx_fn = tx_mpr;
#  562|-> 	peer->tx_data = &tx_info;
#  563|   
#  564|   	ctrl = nvme_mi_init_ctrl(ep, 1);

Error: CPPCHECK_WARNING (CWE-562): [#def43]
libnvme-1.13/test/mi-mctp.c:649: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  647|   
#  648|   	peer->tx_fn = tx_fn_mpr_poll;
#  649|-> 	peer->tx_data = &tx_info;
#  650|   
#  651|   	peer->poll_fn = poll_fn_mpr_poll;

Error: CPPCHECK_WARNING (CWE-562): [#def44]
libnvme-1.13/test/mi-mctp.c:652: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  650|   
#  651|   	peer->poll_fn = poll_fn_mpr_poll;
#  652|-> 	peer->poll_data = &poll_info;
#  653|   
#  654|   	rc = nvme_mi_mi_read_mi_data_subsys(ep, &ss_info);

Error: CPPCHECK_WARNING (CWE-562): [#def45]
libnvme-1.13/test/mi-mctp.c:678: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  676|   
#  677|   	peer->tx_fn = tx_fn_mpr_poll;
#  678|-> 	peer->tx_data = &tx_info;
#  679|   
#  680|   	peer->poll_fn = poll_fn_mpr_poll;

Error: CPPCHECK_WARNING (CWE-562): [#def46]
libnvme-1.13/test/mi-mctp.c:681: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  679|   
#  680|   	peer->poll_fn = poll_fn_mpr_poll;
#  681|-> 	peer->poll_data = &poll_info;
#  682|   
#  683|   	rc = nvme_mi_mi_read_mi_data_subsys(ep, &ss_info);

Error: CPPCHECK_WARNING (CWE-562): [#def47]
libnvme-1.13/test/mi-mctp.c:707: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  705|   
#  706|   	peer->tx_fn = tx_fn_mpr_poll;
#  707|-> 	peer->tx_data = &tx_info;
#  708|   
#  709|   	peer->poll_fn = poll_fn_mpr_poll;

Error: CPPCHECK_WARNING (CWE-562): [#def48]
libnvme-1.13/test/mi-mctp.c:710: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  708|   
#  709|   	peer->poll_fn = poll_fn_mpr_poll;
#  710|-> 	peer->poll_data = &poll_info;
#  711|   
#  712|   	rc = nvme_mi_mi_read_mi_data_subsys(ep, &ss_info);

Error: CPPCHECK_WARNING (CWE-457): [#def49]
libnvme-1.13/test/mi.c:986: warning[uninitvar]: Uninitialized variable: exp
#  984|   	assert(args.data_len == sizeof(tstamp));
#  985|   	assert(tstamp.attr == 1);
#  986|-> 	assert(!memcmp(tstamp.timestamp, exp, sizeof(tstamp.timestamp)));
#  987|   }
#  988|   

Error: CPPCHECK_WARNING (CWE-476): [#def50]
libnvme-1.13/test/mock-ifaddrs.c:38: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: storage
#   36|   
#   37|   	p = &storage->ifa;
#   38|-> 	p->ifa_next = last ? NULL : &storage[1].ifa;
#   39|   	p->ifa_name = storage->name;
#   40|   	strcpy(p->ifa_name, ifname);

Error: CPPCHECK_WARNING (CWE-476): [#def51]
libnvme-1.13/test/mock-ifaddrs.c:39: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: storage
#   37|   	p = &storage->ifa;
#   38|   	p->ifa_next = last ? NULL : &storage[1].ifa;
#   39|-> 	p->ifa_name = storage->name;
#   40|   	strcpy(p->ifa_name, ifname);
#   41|   	p->ifa_flags = 0;

Scan Properties

analyzer-version-clippy1.86.0
analyzer-version-cppcheck2.17.1
analyzer-version-gcc15.0.1
analyzer-version-gcc-analyzer15.0.1
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-137.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250425.124705.g1c7c448.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-namelibnvme-1.13-1.fc43
store-results-to/tmp/tmp83s090j4/libnvme-1.13-1.fc43.tar.xz
time-created2025-04-25 14:06:29
time-finished2025-04-25 14:09:25
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'unicontrol,cppcheck,gcc,clippy,shellcheck' '-o' '/tmp/tmp83s090j4/libnvme-1.13-1.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmp83s090j4/libnvme-1.13-1.fc43.src.rpm'
tool-versioncsmock-3.8.1.20250422.172604.g26bc3d6-1.el9