libnvme-1.8-2.fc41

List of Defects

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1]
libnvme-1.8/examples/telemetry-listen.c: scope_hint: In function ‘main’
libnvme-1.8/examples/telemetry-listen.c:156:48: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘e’
libnvme-1.8/src/nvme/fabrics.h:14: included_from: Included from here.
libnvme-1.8/src/libnvme.h:21: included_from: Included from here.
libnvme-1.8/examples/telemetry-listen.c:21: included_from: Included from here.
libnvme-1.8/examples/telemetry-listen.c:139:9: note: in expansion of macro ‘nvme_for_each_host’
/usr/include/sys/select.h:30: included_from: Included from here.
/usr/include/sys/types.h:179: included_from: Included from here.
/usr/include/stdlib.h:514: included_from: Included from here.
libnvme-1.8/examples/telemetry-listen.c:17: included_from: Included from here.
libnvme-1.8/examples/telemetry-listen.c:148:9: note: in expansion of macro ‘nvme_for_each_host’
libnvme-1.8/examples/telemetry-listen.c:149:17: note: in expansion of macro ‘nvme_for_each_subsystem’
libnvme-1.8/examples/telemetry-listen.c:149:17: note: in expansion of macro ‘nvme_for_each_subsystem’
libnvme-1.8/examples/telemetry-listen.c:150:25: note: in expansion of macro ‘nvme_subsystem_for_each_ctrl’
libnvme-1.8/examples/telemetry-listen.c:150:25: note: in expansion of macro ‘nvme_subsystem_for_each_ctrl’
#  154|   					continue;
#  155|   				FD_SET(fd, &fds);
#  156|-> 				e[i].uevent_fd = fd;
#  157|   				e[i].c = c;
#  158|   				i++;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def2]
libnvme-1.8/src/nvme/cleanup.h:36:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(nvmf_dev, 0)’
libnvme-1.8/src/nvme/fabrics.c: scope_hint: In function ‘__nvmf_supported_options’
libnvme-1.8/src/nvme/fabrics.c:246:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:247:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:247:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:248:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:248:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:249:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:249:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:250:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:250:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:251:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:251:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:252:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:252:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:254:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:254:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:255:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:255:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:256:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:256:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:257:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:257:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:258:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:258:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:259:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:259:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:260:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:260:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:261:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:261:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:262:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:262:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:263:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:263:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:418:13: note: in expansion of macro ‘nvmf_check_option’
libnvme-1.8/src/nvme/fabrics.c:589:13: note: in expansion of macro ‘add_argument’
libnvme-1.8/src/nvme/fabrics.c:11: included_from: Included from here.
libnvme-1.8/src/nvme/fabrics.c:41: included_from: Included from here.
libnvme-1.8/src/nvme/fabrics.c:693:17: note: in expansion of macro ‘nvme_msg’
#   34|   static inline void cleanup_fd(int *fd)
#   35|   {
#   36|-> 	if (*fd >= 0)
#   37|   		close(*fd);
#   38|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def3]
libnvme-1.8/src/nvme/fabrics.c: scope_hint: In function ‘__nvmf_supported_options’
libnvme-1.8/src/nvme/fabrics.c:668:12: warning[-Wanalyzer-malloc-leak]: leak of ‘*((struct nvme_root *)r).options’
libnvme-1.8/src/nvme/fabrics.c:1014:13: note: in expansion of macro ‘nvmf_check_option’
libnvme-1.8/src/nvme/fabrics.c:1014:13: note: in expansion of macro ‘nvmf_check_option’
#  666|   
#  667|   	r->options = calloc(1, sizeof(*r->options));
#  668|-> 	if (!r->options)
#  669|   		return -ENOMEM;
#  670|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def4]
libnvme-1.8/src/nvme/fabrics.c:704:22: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(nvmf_dev, 0)’
libnvme-1.8/src/nvme/fabrics.c:246:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:247:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:247:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:248:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:248:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:249:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:249:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:250:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:250:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:251:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:251:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:252:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:252:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:254:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:254:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:255:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:255:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:256:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:256:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:257:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:257:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:258:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:258:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:259:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:259:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:260:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:260:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:261:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:261:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:262:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:262:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:263:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:263:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:418:13: note: in expansion of macro ‘nvmf_check_option’
libnvme-1.8/src/nvme/fabrics.c:589:13: note: in expansion of macro ‘add_argument’
#  702|   
#  703|   	while ((p = strsep(&options, ",\n")) != NULL) {
#  704|-> 		if (!*p)
#  705|   			continue;
#  706|   		v = strsep(&p, "= ");

Error: CLANG_WARNING: [#def5]
libnvme-1.8/src/nvme/fabrics.c:838:2: warning[deadcode.DeadStores]: Value stored to 'cfg' is never read
#  836|   
#  837|   	/* highest prio have configs from command line */
#  838|-> 	cfg = merge_config(c, cfg);
#  839|   
#  840|   	/* apply configuration from config file (JSON) */

Error: CLANG_WARNING: [#def6]
libnvme-1.8/src/nvme/fabrics.c:855:4: warning[deadcode.DeadStores]: Value stored to 'cfg' is never read
#  853|   			const char *key;
#  854|   
#  855|-> 			cfg = merge_config(c, nvme_ctrl_get_config(fc));
#  856|   			/*
#  857|   			 * An authentication key might already been set

Error: CLANG_WARNING: [#def7]
libnvme-1.8/src/nvme/fabrics.c:1211:4: warning[unix.Malloc]: Potential leak of memory pointed to by 'filename'
# 1209|   	ssize_t len;
# 1210|   
# 1211|-> 	f = open(filename, O_RDONLY);
# 1212|   	if (f < 0)
# 1213|   		return -ENXIO;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def8]
libnvme-1.8/src/nvme/fabrics.c:1211:13: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(uuid_ibm_filename(), 0)’
# 1209|   	ssize_t len;
# 1210|   
# 1211|-> 	f = open(filename, O_RDONLY);
# 1212|   	if (f < 0)
# 1213|   		return -ENXIO;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def9]
libnvme-1.8/src/nvme/fabrics.c: scope_hint: In function ‘uuid_from_device_tree’
libnvme-1.8/src/nvme/fabrics.c:1211:13: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected
/usr/include/features.h:511: included_from: Included from here.
/usr/include/ctype.h:25: included_from: Included from here.
libnvme-1.8/src/nvme/fabrics.c:10: included_from: Included from here.
/usr/include/fcntl.h:212:12: note: argument 1 of ‘open’ must be non-null
# 1209|   	ssize_t len;
# 1210|   
# 1211|-> 	f = open(filename, O_RDONLY);
# 1212|   	if (f < 0)
# 1213|   		return -ENXIO;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def10]
libnvme-1.8/src/nvme/fabrics.c:1211:13: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘uuid_ibm_filename()’ where non-null expected
/usr/include/fcntl.h:212:12: note: argument 1 of ‘open’ must be non-null
# 1209|   	ssize_t len;
# 1210|   
# 1211|-> 	f = open(filename, O_RDONLY);
# 1212|   	if (f < 0)
# 1213|   		return -ENXIO;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def11]
libnvme-1.8/src/nvme/fabrics.c:1273:13: warning[-Wanalyzer-malloc-leak]: leak of ‘opendir(dmi_entries_dir())’
# 1271|   
# 1272|   	system_uuid[0] = '\0';
# 1273|-> 	d = opendir(entries_dir);
# 1274|   	if (!d)
# 1275|   		return -ENXIO;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def12]
libnvme-1.8/src/nvme/fabrics.c: scope_hint: In function ‘uuid_from_dmi_entries’
libnvme-1.8/src/nvme/fabrics.c:1273:13: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected
libnvme-1.8/src/nvme/fabrics.c:20: included_from: Included from here.
/usr/include/dirent.h:141:13: note: argument 1 of ‘opendir’ must be non-null
# 1271|   
# 1272|   	system_uuid[0] = '\0';
# 1273|-> 	d = opendir(entries_dir);
# 1274|   	if (!d)
# 1275|   		return -ENXIO;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def13]
libnvme-1.8/src/nvme/fabrics.c:1273:13: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘dmi_entries_dir()’ where non-null expected
/usr/include/dirent.h:141:13: note: argument 1 of ‘opendir’ must be non-null
# 1271|   
# 1272|   	system_uuid[0] = '\0';
# 1273|-> 	d = opendir(entries_dir);
# 1274|   	if (!d)
# 1275|   		return -ENXIO;

Error: CLANG_WARNING: [#def14]
libnvme-1.8/src/nvme/fabrics.c:1275:11: warning[unix.Malloc]: Potential leak of memory pointed to by 'entries_dir'
# 1273|   	d = opendir(entries_dir);
# 1274|   	if (!d)
# 1275|-> 		return -ENXIO;
# 1276|   	while ((de = readdir(d))) {
# 1277|   		char filename[PATH_MAX];

Error: GCC_ANALYZER_WARNING (CWE-775): [#def15]
libnvme-1.8/src/nvme/fabrics.c:1283:21: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(&filename, 0)’
# 1281|   			continue;
# 1282|   		sprintf(filename, "%s/%s/type", entries_dir, de->d_name);
# 1283|-> 		f = open(filename, O_RDONLY);
# 1284|   		if (f < 0)
# 1285|   			continue;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def16]
libnvme-1.8/src/nvme/fabrics.c:1286:23: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(&filename, 0)’
# 1284|   		if (f < 0)
# 1285|   			continue;
# 1286|-> 		len = read(f, buf, 512);
# 1287|   		close(f);
# 1288|   		if (len <= 0)

Error: GCC_ANALYZER_WARNING (CWE-775): [#def17]
libnvme-1.8/src/nvme/fabrics.c:1295:21: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(&filename, 0)’
# 1293|   			continue;
# 1294|   		sprintf(filename, "%s/%s/raw", entries_dir, de->d_name);
# 1295|-> 		f = open(filename, O_RDONLY);
# 1296|   		if (f < 0)
# 1297|   			continue;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def18]
libnvme-1.8/src/nvme/fabrics.c:1298:23: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(&filename, 0)’
# 1296|   		if (f < 0)
# 1297|   			continue;
# 1298|-> 		len = read(f, buf, 512);
# 1299|   		close(f);
# 1300|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def19]
libnvme-1.8/src/nvme/fabrics.c: scope_hint: In function ‘uuid_from_product_uuid’
libnvme-1.8/src/nvme/fabrics.c:1337:18: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen("/sys/class/dmi/id/product_uuid", "re")’
# 1335|   	size_t len = 0;
# 1336|   
# 1337|-> 	stream = fopen(PATH_DMI_PROD_UUID, "re");
# 1338|   	if (!stream)
# 1339|   		return -ENXIO;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def20]
libnvme-1.8/src/nvme/fabrics.c:1337:18: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen("/sys/class/dmi/id/product_uuid", "re")’
# 1335|   	size_t len = 0;
# 1336|   
# 1337|-> 	stream = fopen(PATH_DMI_PROD_UUID, "re");
# 1338|   	if (!stream)
# 1339|   		return -ENXIO;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def21]
libnvme-1.8/src/nvme/fabrics.c: scope_hint: In function ‘nvmf_is_registration_supported’
libnvme-1.8/src/nvme/fabrics.c:1720:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘*c.dctype’ where non-null expected
libnvme-1.8/src/nvme/fabrics.c:18: included_from: Included from here.
/usr/include/string.h:156:12: note: argument 1 of ‘strcmp’ must be non-null
# 1718|   			return false;
# 1719|   
# 1720|-> 	return !strcmp(c->dctype, "ddc") || !strcmp(c->dctype, "cdc");
# 1721|   }
# 1722|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def22]
libnvme-1.8/src/nvme/filters.c: scope_hint: In function ‘nvme_scan_subsystems’
libnvme-1.8/src/nvme/filters.c:137:16: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected
/usr/include/features.h:511: included_from: Included from here.
/usr/include/bits/libc-header-start.h:33: included_from: Included from here.
/usr/include/stdlib.h:26: included_from: Included from here.
libnvme-1.8/src/nvme/filters.c:9: included_from: Included from here.
/usr/include/dirent.h:265:12: note: argument 1 of ‘scandir’ must be non-null
#  135|   	_cleanup_free_ char *dir = nvme_subsys_sysfs_dir();
#  136|   
#  137|-> 	return scandir(dir, subsys, nvme_subsys_filter, alphasort);
#  138|   }
#  139|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def23]
libnvme-1.8/src/nvme/filters.c:137:16: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘nvme_subsys_sysfs_dir()’ where non-null expected
/usr/include/dirent.h:265:12: note: argument 1 of ‘scandir’ must be non-null
#  135|   	_cleanup_free_ char *dir = nvme_subsys_sysfs_dir();
#  136|   
#  137|-> 	return scandir(dir, subsys, nvme_subsys_filter, alphasort);
#  138|   }
#  139|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def24]
libnvme-1.8/src/nvme/filters.c: scope_hint: In function ‘nvme_scan_ctrls’
libnvme-1.8/src/nvme/filters.c:150:16: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected
/usr/include/dirent.h:265:12: note: argument 1 of ‘scandir’ must be non-null
#  148|   	_cleanup_free_ char *dir = nvme_ctrl_sysfs_dir();
#  149|   
#  150|-> 	return scandir(dir, ctrls, nvme_ctrls_filter, alphasort);
#  151|   }
#  152|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def25]
libnvme-1.8/src/nvme/filters.c:150:16: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘nvme_ctrl_sysfs_dir()’ where non-null expected
/usr/include/dirent.h:265:12: note: argument 1 of ‘scandir’ must be non-null
#  148|   	_cleanup_free_ char *dir = nvme_ctrl_sysfs_dir();
#  149|   
#  150|-> 	return scandir(dir, ctrls, nvme_ctrls_filter, alphasort);
#  151|   }
#  152|   

Error: CLANG_WARNING: [#def26]
libnvme-1.8/src/nvme/json.c:218:10: warning[unix.Malloc]: Potential leak of memory pointed to by 'ptr'
#  216|   
#  217|   	if (ret < 0 || !len)
#  218|-> 		return NULL;
#  219|   
#  220|   	tok = json_tokener_new_ex(JSON_TOKENER_DEFAULT_DEPTH);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def27]
libnvme-1.8/src/nvme/linux.c: scope_hint: In function ‘__nvme_open’
libnvme-1.8/src/nvme/linux.c:56:16: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(path, 0)’
#   54|   	}
#   55|   
#   56|-> 	return open(path, O_RDONLY);
#   57|   }
#   58|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def28]
libnvme-1.8/src/nvme/linux.c: scope_hint: In function ‘nvme_get_attr’
libnvme-1.8/src/nvme/linux.c:477:30: warning[-Wanalyzer-malloc-leak]: leak of ‘__nvme_get_attr(path)’
#  475|   	if (value[strlen(value) - 1] == '\n')
#  476|   		value[strlen(value) - 1] = '\0';
#  477|-> 	while (strlen(value) > 0 && value[strlen(value) - 1] == ' ')
#  478|   		value[strlen(value) - 1] = '\0';
#  479|   

Error: CLANG_WARNING: [#def29]
libnvme-1.8/src/nvme/linux.c:1027:11: warning[unix.Malloc]: Potential leak of memory pointed to by 'psk_ctx'
# 1025|   
# 1026|   	if (!EVP_MAC_init(mac_ctx, retained, key_len, params)) {
# 1027|-> 		errno = ENOKEY;
# 1028|   		return -1;
# 1029|   	}

Error: GCC_ANALYZER_WARNING (CWE-688): [#def30]
libnvme-1.8/src/nvme/linux.c: scope_hint: In function ‘gen_tls_identity’
libnvme-1.8/src/nvme/linux.c:1062:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘malloc(hmac_len * 2)’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_memset’ must be non-null
# 1060|   	}
# 1061|   	enc_ctx = malloc(hmac_len * 2);
# 1062|-> 	memset(enc_ctx, 0, hmac_len * 2);
# 1063|   	len = base64_encode(psk_ctx, hmac_len, enc_ctx);
# 1064|   	if (len < 0) {

Error: CLANG_WARNING: [#def31]
libnvme-1.8/src/nvme/linux.c:1223:11: warning[unix.Malloc]: Potential leak of memory pointed to by 'identity'
# 1221|   	psk = malloc(key_len);
# 1222|   	if (!psk) {
# 1223|-> 		errno = ENOMEM;
# 1224|   		return 0;
# 1225|   	}

Error: CPPCHECK_WARNING (CWE-401): [#def32]
libnvme-1.8/src/nvme/linux.c:1224: error[memleak]: Memory leak: identity
# 1222|   	if (!psk) {
# 1223|   		errno = ENOMEM;
# 1224|-> 		return 0;
# 1225|   	}
# 1226|   	memset(psk, 0, key_len);

Error: CLANG_WARNING: [#def33]
libnvme-1.8/src/nvme/mi-mctp.c:637:7: warning[core.uninitialized.Branch]: Branch condition evaluates to a garbage value
#  635|   		}
#  636|   
#  637|-> 		if (rc)
#  638|   			return rc;
#  639|   

Error: CLANG_WARNING: [#def34]
libnvme-1.8/src/nvme/mi-mctp.c:784:2: warning[deadcode.DeadStores]: Value stored to 'rc' is never read
#  782|   	dbus_message_iter_recurse(&args, &objs);
#  783|   
#  784|-> 	rc = 0;
#  785|   
#  786|   	for (;;) {

Error: CPPCHECK_WARNING (CWE-457): [#def35]
libnvme-1.8/src/nvme/mi.c:1336: error[uninitvar]: Uninitialized variable: resp_hdr.status
# 1334|   		return rc;
# 1335|   
# 1336|-> 	if (resp_hdr.status)
# 1337|   		return resp_hdr.status;
# 1338|   

Error: CPPCHECK_WARNING (CWE-457): [#def36]
libnvme-1.8/src/nvme/mi.c:1461: error[uninitvar]: Uninitialized variable: resp_hdr.status
# 1459|   		return rc;
# 1460|   
# 1461|-> 	if (resp_hdr.status)
# 1462|   		return resp_hdr.status;
# 1463|   

Error: CPPCHECK_WARNING (CWE-457): [#def37]
libnvme-1.8/src/nvme/mi.c:1504: error[uninitvar]: Uninitialized variable: resp_hdr.status
# 1502|   		return rc;
# 1503|   
# 1504|-> 	if (resp_hdr.status)
# 1505|   		return resp_hdr.status;
# 1506|   

Error: CPPCHECK_WARNING (CWE-457): [#def38]
libnvme-1.8/src/nvme/mi.c:1541: error[uninitvar]: Uninitialized variable: resp_hdr.status
# 1539|   		return rc;
# 1540|   
# 1541|-> 	if (resp_hdr.status)
# 1542|   		return resp_hdr.status;
# 1543|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def39]
libnvme-1.8/src/nvme/nbft.c: scope_hint: In function ‘read_discovery’
libnvme-1.8/src/nvme/nbft.c:472:12: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘d’
libnvme-1.8/src/nvme/nbft.c:551:9: note: in expansion of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:553:9: note: in expansion of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:560:9: note: in expansion of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:561:9: note: in expansion of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:562:9: note: in expansion of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:563:9: note: in expansion of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:564:9: note: in expansion of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:574:9: note: in expansion of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:580:9: note: in expansion of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:586:9: note: in expansion of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:587:9: note: in expansion of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:589:13: note: in expansion of macro ‘get_heap_obj’
libnvme-1.8/src/nvme/nbft.c:17: included_from: Included from here.
libnvme-1.8/src/nvme/nbft.c:104:25: note: in expansion of macro ‘nvme_msg’
libnvme-1.8/src/nvme/nbft.c:589:13: note: in expansion of macro ‘get_heap_obj’
libnvme-1.8/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:630:17: note: in expansion of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:443:9: note: in expansion of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:454:13: note: in expansion of macro ‘get_heap_obj’
libnvme-1.8/src/nvme/nbft.c:454:13: note: in expansion of macro ‘get_heap_obj’
libnvme-1.8/src/nvme/nbft.c:457:13: note: in expansion of macro ‘get_heap_obj’
libnvme-1.8/src/nvme/nbft.c:457:13: note: in expansion of macro ‘get_heap_obj’
libnvme-1.8/src/nvme/nbft.c:457:13: note: in expansion of macro ‘get_heap_obj’
libnvme-1.8/src/nvme/nbft.c: scope_hint: In function ‘read_discovery’
#  470|   			 nbft->filename, discovery->index);
#  471|   
#  472|-> 	*d = discovery;
#  473|   	r = 0;
#  474|   

Error: CLANG_WARNING: [#def40]
libnvme-1.8/src/nvme/nbft.c:493:19: warning[unix.MallocSizeof]: Result of 'calloc' is converted to a pointer of type 'struct nbft_info_hfi *', which is incompatible with sizeof operand type 'struct nbft_info_hfi'
#  491|   	int i, cnt;
#  492|   
#  493|-> 	nbft->hfi_list = calloc(num_hfi + 1, sizeof(struct nbft_info_hfi));
#  494|   	for (i = 0, cnt = 0; i < num_hfi; i++) {
#  495|   		if (read_hfi(nbft, &raw_hfi_array[i], &nbft->hfi_list[cnt]) == 0)

Error: CLANG_WARNING: [#def41]
libnvme-1.8/src/nvme/nbft.c:505:24: warning[unix.MallocSizeof]: Result of 'calloc' is converted to a pointer of type 'struct nbft_info_security *', which is incompatible with sizeof operand type 'struct nbft_info_security'
#  503|   	int i, cnt;
#  504|   
#  505|-> 	nbft->security_list = calloc(num_sec + 1, sizeof(struct nbft_info_security));
#  506|   	for (i = 0, cnt = 0; i < num_sec; i++) {
#  507|   		if (read_security(nbft, &raw_sec_array[i], &nbft->security_list[cnt]) == 0)

Error: GCC_ANALYZER_WARNING (CWE-131): [#def42]
libnvme-1.8/src/nvme/nbft.c:505:29: warning[-Wanalyzer-allocation-size]: allocated buffer size is not a multiple of the pointee's size
libnvme-1.8/src/nvme/nbft.c: scope_hint: In function ‘parse_raw_nbft’
libnvme-1.8/src/nvme/nbft.c:551:9: note: in expansion of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:553:9: note: in expansion of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:560:9: note: in expansion of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:561:9: note: in expansion of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:562:9: note: in expansion of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:563:9: note: in expansion of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:564:9: note: in expansion of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:574:9: note: in expansion of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:580:9: note: in expansion of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:586:9: note: in expansion of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:587:9: note: in expansion of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:589:13: note: in expansion of macro ‘get_heap_obj’
libnvme-1.8/src/nvme/nbft.c:104:25: note: in expansion of macro ‘nvme_msg’
libnvme-1.8/src/nvme/nbft.c:589:13: note: in expansion of macro ‘get_heap_obj’
libnvme-1.8/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’
libnvme-1.8/src/nvme/nbft.c:614:17: note: in expansion of macro ‘verify’
#  503|   	int i, cnt;
#  504|   
#  505|-> 	nbft->security_list = calloc(num_sec + 1, sizeof(struct nbft_info_security));
#  506|   	for (i = 0, cnt = 0; i < num_sec; i++) {
#  507|   		if (read_security(nbft, &raw_sec_array[i], &nbft->security_list[cnt]) == 0)

Error: CLANG_WARNING: [#def43]
libnvme-1.8/src/nvme/nbft.c:517:25: warning[unix.MallocSizeof]: Result of 'calloc' is converted to a pointer of type 'struct nbft_info_discovery *', which is incompatible with sizeof operand type 'struct nbft_info_discovery'
#  515|   	int i, cnt;
#  516|   
#  517|-> 	nbft->discovery_list = calloc(num_disc + 1, sizeof(struct nbft_info_discovery));
#  518|   	for (i = 0, cnt = 0; i < num_disc; i++) {
#  519|   		if (read_discovery(nbft, &raw_disc_array[i], &nbft->discovery_list[cnt]) == 0)

Error: CLANG_WARNING: [#def44]
libnvme-1.8/src/nvme/nbft.c:529:28: warning[unix.MallocSizeof]: Result of 'calloc' is converted to a pointer of type 'struct nbft_info_subsystem_ns *', which is incompatible with sizeof operand type 'struct nbft_info_subsystem_ns'
#  527|   	int i, cnt;
#  528|   
#  529|-> 	nbft->subsystem_ns_list = calloc(num_ssns + 1, sizeof(struct nbft_info_subsystem_ns));
#  530|   	for (i = 0, cnt = 0; i < num_ssns; i++) {
#  531|   		if (read_ssns(nbft, &raw_ssns_array[i], &nbft->subsystem_ns_list[cnt]) == 0)

Error: GCC_ANALYZER_WARNING (CWE-775): [#def45]
libnvme-1.8/src/nvme/private.h:200:25: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(nvmf_dev, 0)’
libnvme-1.8/src/nvme/fabrics.c:686:25: note: in expansion of macro ‘nvme_msg’
libnvme-1.8/src/nvme/fabrics.c:246:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:247:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:247:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:248:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:248:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:249:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:249:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:250:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:250:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:251:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:251:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:252:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:252:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:254:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:254:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:255:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:255:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:256:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:256:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:257:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:257:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:258:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:258:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:259:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:259:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:260:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:260:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:261:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:261:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:262:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:262:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:263:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:263:9: note: in expansion of macro ‘MERGE_CFG_OPTION’
libnvme-1.8/src/nvme/fabrics.c:418:13: note: in expansion of macro ‘nvmf_check_option’
libnvme-1.8/src/nvme/fabrics.c:589:13: note: in expansion of macro ‘add_argument’
libnvme-1.8/src/nvme/fabrics.c:686:25: note: in expansion of macro ‘nvme_msg’
libnvme-1.8/src/nvme/fabrics.c:686:25: note: in expansion of macro ‘nvme_msg’
#  198|   	do {								\
#  199|   		if ((lvl) <= MAX_LOGLEVEL)				\
#  200|-> 			__nvme_msg(r, lvl, __nvme_log_func,		\
#  201|   				   format, ##__VA_ARGS__);		\
#  202|   	} while (0)

Error: GCC_ANALYZER_WARNING (CWE-476): [#def46]
libnvme-1.8/src/nvme/tree.c: scope_hint: In function ‘nvme_host_set_hostsymname’
libnvme-1.8/src/nvme/tree.c:321:14: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘h’
#  319|   void nvme_host_set_hostsymname(nvme_host_t h, const char *hostsymname)
#  320|   {
#  321|-> 	if (h->hostsymname) {
#  322|   		free(h->hostsymname);
#  323|   		h->hostsymname = NULL;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def47]
libnvme-1.8/src/nvme/tree.c: scope_hint: In function ‘nvme_init_subsystem’
libnvme-1.8/src/nvme/tree.c:688:22: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘*s.subsysnqn’ where non-null expected
libnvme-1.8/src/nvme/filters.h:13: included_from: Included from here.
libnvme-1.8/src/nvme/tree.c:31: included_from: Included from here.
libnvme-1.8/src/nvme/tree.c:624:9: note: in expansion of macro ‘nvme_for_each_host’
libnvme-1.8/src/nvme/tree.c:37: included_from: Included from here.
libnvme-1.8/src/nvme/tree.c:1722:17: note: in expansion of macro ‘nvme_msg’
libnvme-1.8/src/nvme/tree.c:568:9: note: in expansion of macro ‘nvme_for_each_subsystem’
libnvme-1.8/src/nvme/tree.c:14: included_from: Included from here.
/usr/include/string.h:156:12: note: argument 1 of ‘strcmp’ must be non-null
#  686|   	s->subsystype = nvme_get_attr(path, "subsystype");
#  687|   	if (!s->subsystype) {
#  688|-> 		if (!strcmp(s->subsysnqn, NVME_DISC_SUBSYS_NAME))
#  689|   			s->subsystype = strdup("discovery");
#  690|   		else

Error: GCC_ANALYZER_WARNING (CWE-401): [#def48]
libnvme-1.8/src/nvme/tree.c: scope_hint: In function ‘nvme_scan_ctrl’
libnvme-1.8/src/nvme/tree.c:1713:31: warning[-Wanalyzer-malloc-leak]: leak of ‘nvme_ctrl_lookup_subsystem_name(r,  name)’
libnvme-1.8/src/nvme/tree.c:624:9: note: in expansion of macro ‘nvme_for_each_host’
libnvme-1.8/src/nvme/tree.c:1722:17: note: in expansion of macro ‘nvme_msg’
# 1711|   	if (subsys.num < 0)
# 1712|   		return NULL;
# 1713|-> 	for (i = 0; i < subsys.num; i++) {
# 1714|   		struct stat st;
# 1715|   		_cleanup_free_ char *path = NULL;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def49]
libnvme-1.8/src/nvme/tree.c: scope_hint: In function ‘__nvme_scan_namespace’
libnvme-1.8/src/nvme/tree.c:2077:12: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
libnvme-1.8/src/nvme/tree.c: scope_hint: In function ‘__nvme_scan_namespace’
libnvme-1.8/src/nvme/tree.c: scope_hint: In function ‘__nvme_scan_namespace’
# 2075|   void nvme_ns_release_fd(nvme_ns_t n)
# 2076|   {
# 2077|-> 	if (n->fd < 0)
# 2078|   		return;
# 2079|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def50]
libnvme-1.8/src/nvme/tree.c:2434:50: warning[-Wanalyzer-malloc-leak]: leak of ‘nvme_ns_open(path,  nvme_ns_generic_to_blkdev(name))’
libnvme-1.8/src/nvme/tree.c: scope_hint: In function ‘__nvme_scan_namespace’
libnvme-1.8/src/nvme/tree.c: scope_hint: In function ‘__nvme_scan_namespace’
# 2432|   
# 2433|   	for (i = 0; i < size; i++) {
# 2434|-> 		struct sysfs_attr_table *e = &tbl[i];
# 2435|   
# 2436|   		str = nvme_get_attr(path, e->name);

Error: CPPCHECK_WARNING (CWE-404): [#def51]
libnvme-1.8/src/nvme/util.c:770: error[resourceLeak]: Resource leak: file
#  768|   
#  769|   	if (!p)
#  770|-> 		return 0;
#  771|   
#  772|   	 /* Strip unwanted trailing chars */

Error: CPPCHECK_WARNING (CWE-404): [#def52]
libnvme-1.8/src/nvme/util.c:776: error[resourceLeak]: Resource leak: file
#  774|   	*bufsz -= len;
#  775|   
#  776|-> 	return len;
#  777|   }
#  778|   

Error: CPPCHECK_WARNING (CWE-562): [#def53]
libnvme-1.8/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): [#def54]
libnvme-1.8/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): [#def55]
libnvme-1.8/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): [#def56]
libnvme-1.8/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): [#def57]
libnvme-1.8/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): [#def58]
libnvme-1.8/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): [#def59]
libnvme-1.8/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): [#def60]
libnvme-1.8/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): [#def61]
libnvme-1.8/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): [#def62]
libnvme-1.8/test/mi.c:945: warning[uninitvar]: Uninitialized variable: exp
#  943|   	assert(args.data_len == sizeof(tstamp));
#  944|   	assert(tstamp.attr == 1);
#  945|-> 	assert(!memcmp(tstamp.timestamp, exp, sizeof(tstamp.timestamp)));
#  946|   }
#  947|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def63]
libnvme-1.8/test/mock-ifaddrs.c:38:21: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘storage’
libnvme-1.8/test/mock-ifaddrs.c: scope_hint: In function ‘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): [#def64]
libnvme-1.8/test/mock-ifaddrs.c: scope_hint: In function ‘getifaddrs’
libnvme-1.8/test/mock-ifaddrs.c:117:16: warning[-Wanalyzer-malloc-leak]: leak of ‘storage’
libnvme-1.8/test/mock-ifaddrs.c:7: included_from: Included from here.
libnvme-1.8/test/mock-ifaddrs.c: scope_hint: In function ‘getifaddrs’
#  115|   	init_entry(&storage[3], "lo", AF_INET6, 0, 0, 0, 1, true); /* ::1 */
#  116|   
#  117|-> 	return 0;
#  118|   }
#  119|   

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
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-114.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-namelibnvme-1.8-2.fc41
store-results-to/tmp/tmpv468yjlk/libnvme-1.8-2.fc41.tar.xz
time-created2024-04-22 11:05:32
time-finished2024-04-22 11:08:01
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpv468yjlk/libnvme-1.8-2.fc41.tar.xz' '--gcc-analyze' '/tmp/tmpv468yjlk/libnvme-1.8-2.fc41.src.rpm'
tool-versioncsmock-3.5.3-1.el9