nvme-cli-2.9.1-2.fc41

List of Defects

Error: CPPCHECK_WARNING: [#def1]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/ccan/ccan/htable/htable.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def2]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nbft.c:11: included_from: Included from here.
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nbft.h:3: included_from: Included from here.
nvme-cli-2.9.1-build/nvme-cli-2.9.1/ccan/ccan/list/list.h:482:2: warning[unix.Malloc]: Use of memory after it is freed
#  480|   		return NULL;
#  481|   	n = h->n.next;
#  482|-> 	list_del(n);
#  483|   	return (const char *)n - off;
#  484|   }

Error: CPPCHECK_WARNING: [#def3]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/ccan/ccan/strset/strset.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def4]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/fabrics.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def5]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/fabrics.c:529:8: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
#  527|   
#  528|   			/* ignore none fabric transports */
#  529|-> 			if (strcmp(transport, "tcp") &&
#  530|   			    strcmp(transport, "rdma") &&
#  531|   			    strcmp(transport, "fc"))

Error: CLANG_WARNING: [#def6]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/fabrics.c:664:7: warning[unix.Malloc]: Potential leak of memory pointed to by 'hostid_from_hostnqn'
#  662|   	hostid_from_hostnqn = nvmf_hostid_from_hostnqn(hostnqn);
#  663|   	if (hostid_from_hostnqn && strcmp(hostid_from_hostnqn, hostid)) {
#  664|-> 		if (verbose)
#  665|   			fprintf(stderr,
#  666|   				"warning: use hostid which does not match uuid in hostnqn\n");

Error: CPPCHECK_WARNING: [#def7]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nbft.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-401): [#def8]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nbft.c: scope_hint: In function ‘read_nbft_files’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nbft.c:54:24: warning[-Wanalyzer-malloc-leak]: leak of ‘entry’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nbft.c: scope_hint: In function ‘read_nbft_files’
#   52|   	count = scandir(path, &dent, nbft_filter, NULL);
#   53|   	if (count < 0)
#   54|-> 		return -errno;
#   55|   
#   56|   	for (i = 0; i < count; i++) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def9]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nbft.c:60:33: warning[-Wanalyzer-malloc-leak]: leak of ‘entry’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nbft.c: scope_hint: In function ‘read_nbft_files’
#   58|   		ret = nvme_nbft_read(&nbft, filename);
#   59|   		if (!ret) {
#   60|-> 			entry = calloc(1, sizeof(*entry));
#   61|   			entry->nbft = nbft;
#   62|   			list_add_tail(nbft_list, &entry->node);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def10]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nbft.c:61:37: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘entry’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nbft.c: scope_hint: In function ‘read_nbft_files’
#   59|   		if (!ret) {
#   60|   			entry = calloc(1, sizeof(*entry));
#   61|-> 			entry->nbft = nbft;
#   62|   			list_add_tail(nbft_list, &entry->node);
#   63|   		}

Error: CPPCHECK_WARNING: [#def11]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme-models.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def12]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme-print-json.c:2106:8: warning[core.uninitialized.Branch]: Branch condition evaluates to a garbage value
# 2104|   		for (i = 0; i < log->nd; i++) {
# 2105|   			/* Free any Printable Eye strings allocated */
# 2106|-> 			if (allocated_eyes[i])
# 2107|   				free(allocated_eyes[i]);
# 2108|   		}

Error: CLANG_WARNING: [#def13]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme-print-json.c:2195:26: warning[core.NullDereference]: Access to field 'egchans' results in a dereference of a null pointer (loaded from variable 'chan_desc')
# 2193|   			chan_desc = (struct nvme_end_grp_chan_desc *)
# 2194|   			    (cap_log->cap_config_desc[i].egcd[j].nvmsetid[0] * sizeof(__u16) * egsets);
# 2195|-> 			egchans = le16_to_cpu(chan_desc->egchans);
# 2196|   			obj_add_uint(endurance, "egchans", le16_to_cpu(chan_desc->egchans));
# 2197|   			chan_list = json_create_array();

Error: GCC_ANALYZER_WARNING (CWE-401): [#def14]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme-rpmb.c: scope_hint: In function ‘rpmb_nonce_init’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme-rpmb.c:324:19: warning[-Wanalyzer-malloc-leak]: leak of ‘rpmb_md5(&num, 4)’
#  322|   	int num = rand();
#  323|   	unsigned char *hash = rpmb_md5((unsigned char *)&num, sizeof(num));
#  324|-> 	if (hash) memcpy(req->nonce, hash, sizeof(req->nonce));
#  325|   }
#  326|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def15]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme-rpmb.c: scope_hint: In function ‘rpmb_cmd_option’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme-rpmb.c:949:33: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘msg_buf’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null
#  947|   				msg_size = strlen(cfg.msg);
#  948|   				msg_buf = (unsigned char *)malloc(msg_size);
#  949|-> 				memcpy(msg_buf, cfg.msg, msg_size);
#  950|   			} else {
#  951|   				err = read_file(cfg.msgfile, &msg_buf, &msg_size);

Error: CPPCHECK_WARNING: [#def16]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING (CWE-457): [#def17]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.c:4636: warning[uninitvar]: Uninitialized variable: result_def
# 4634|   		cfg.sel = 8;
# 4635|   
# 4636|-> 	if (err || !changed || err_def || result != result_def ||
# 4637|   	    (buf && buf_def && !strcmp(buf, buf_def)))
# 4638|   		get_feature_id_print(cfg, err, result, buf);

Error: CPPCHECK_WARNING (CWE-457): [#def18]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.c:5340: warning[uninitvar]: Uninitialized variable: err
# 5338|   	}
# 5339|   
# 5340|-> 	if (err)
# 5341|   		free(bar);
# 5342|   	else

Error: GCC_ANALYZER_WARNING (CWE-476): [#def19]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.c: scope_hint: In function ‘mmap_registers’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.c:5358:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘dev’
# 5356|   		prot |= PROT_WRITE;
# 5357|   
# 5358|-> 	sprintf(path, "/sys/class/nvme/%s/device/resource0", dev->name);
# 5359|   	fd = open(path, writable ? O_RDWR : O_RDONLY);
# 5360|   	if (fd < 0) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def20]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.c: scope_hint: In function ‘format_cmd’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.c:6257:17: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘dev’
# 6255|   
# 6256|   	if (!cfg.force) {
# 6257|-> 		fprintf(stderr, "You are about to format %s, namespace %#x%s.\n",
# 6258|   			dev->name, cfg.namespace_id,
# 6259|   			cfg.namespace_id == NVME_NSID_ALL ? "(ALL namespaces)" : "");

Error: GCC_ANALYZER_WARNING (CWE-476): [#def21]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.c:6288:24: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘dev’
# 6286|   	} else {
# 6287|   		printf("Success formatting namespace:%x\n", cfg.namespace_id);
# 6288|-> 		if (dev->type == NVME_DEV_DIRECT && cfg.lbaf != prev_lbaf) {
# 6289|   			if (is_chardev(dev)) {
# 6290|   				if (ioctl(dev_fd(dev), NVME_IOCTL_RESCAN) < 0) {

Error: GCC_ANALYZER_WARNING (CWE-775): [#def22]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.c: scope_hint: In function ‘set_feature’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.c:6427:39: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(cfg.file, 0)’
# 6425|   		} else {
# 6426|   			if (strlen(cfg.file))
# 6427|-> 				ffd = open(cfg.file, O_RDONLY);
# 6428|   
# 6429|   			if (ffd < 0) {

Error: GCC_ANALYZER_WARNING (CWE-775): [#def23]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.c: scope_hint: In function ‘sec_send’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.c:6541:26: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(cfg.file, 0)’
# 6539|   		sec_size = cfg.tl;
# 6540|   	} else {
# 6541|-> 		sec_fd = open(cfg.file, O_RDONLY);
# 6542|   		if (sec_fd < 0) {
# 6543|   			nvme_show_error("Failed to open %s: %s", cfg.file, strerror(errno));

Error: GCC_ANALYZER_WARNING (CWE-775): [#def24]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.c: scope_hint: In function ‘dir_send’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.c:6687:31: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(cfg.file, 0)’
# 6685|   	if (buf) {
# 6686|   		if (strlen(cfg.file)) {
# 6687|-> 			ffd = open(cfg.file, O_RDONLY);
# 6688|   			if (ffd <= 0) {
# 6689|   				nvme_show_error("Failed to open file %s: %s",

Error: GCC_ANALYZER_WARNING: [#def25]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.c:6694:23: warning[-Wanalyzer-fd-use-without-check]: ‘read’ on possibly invalid file descriptor ‘ffd’
# 6692|   			}
# 6693|   		}
# 6694|-> 		err = read(ffd, (void *)buf, cfg.data_len);
# 6695|   		if (err < 0) {
# 6696|   			nvme_show_error("failed to read data buffer from input file %s",

Error: GCC_ANALYZER_WARNING: [#def26]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.c: scope_hint: In function ‘passthru’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.c:8795:29: warning[-Wanalyzer-fd-use-without-check]: ‘read’ on possibly invalid file descriptor ‘mfd’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.c:42: included_from: Included from here.
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.c: scope_hint: In function ‘passthru’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.c: scope_hint: In function ‘passthru’
# 8793|   
# 8794|   		if (cfg.write) {
# 8795|-> 			if (read(mfd, mdata, cfg.metadata_len) < 0) {
# 8796|   				err = -errno;
# 8797|   				nvme_show_perror("failed to read metadata write buffer");

Error: GCC_ANALYZER_WARNING (CWE-775): [#def27]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.c: scope_hint: In function ‘tls_key’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.c:9442:24: warning[-Wanalyzer-file-leak]: leak of FILE ‘fd’
# 9440|   	err = argconfig_parse(argc, argv, desc, opts);
# 9441|   	if (err)
# 9442|-> 		return err;
# 9443|   
# 9444|   	if (cfg.keyfile) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def28]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.c:9442:24: warning[-Wanalyzer-malloc-leak]: leak of ‘fd’
# 9440|   	err = argconfig_parse(argc, argv, desc, opts);
# 9441|   	if (err)
# 9442|-> 		return err;
# 9443|   
# 9444|   	if (cfg.keyfile) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def29]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.h:76:16: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘dev’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.c: scope_hint: In function ‘submit_io’
#   74|   static inline int __dev_fd(struct nvme_dev *dev, const char *func, int line)
#   75|   {
#   76|-> 	if (dev->type != NVME_DEV_DIRECT) {
#   77|   		fprintf(stderr,
#   78|   			"warning: %s:%d not a direct transport!\n",

Error: CPPCHECK_WARNING: [#def30]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugin.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def31]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/huawei/huawei-nvme.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def32]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/huawei/huawei-nvme.c:87:2: warning[deadcode.DeadStores]: Value stored to 'err' is never read
#   85|   
#   86|   	item->huawei_device = true;
#   87|-> 	err = nvme_get_nsid(fd, &item->nsid);
#   88|   	err = nvme_identify_ns(fd, item->nsid, &item->ns);
#   89|   	if (err)

Error: GCC_ANALYZER_WARNING (CWE-126): [#def33]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/huawei/huawei-nvme.c: scope_hint: In function ‘huawei_get_nvme_info’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/huawei/huawei-nvme.c:96:9: warning[-Wanalyzer-out-of-bounds]: stack-based buffer over-read
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/huawei/huawei-nvme.c:96:9: note: read of 760 bytes from after the end of ‘path’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/huawei/huawei-nvme.c:96:9: note: valid subscripts for ‘path’ are ‘[0]’ to ‘[263]’
#  └──────────────────────────────────────────────────────────────────────┘
#      ^          ^           ^                        ^
#   94|   		return err;
#   95|   
#   96|-> 	strncpy(item->node, node, sizeof(item->node));
#   97|   	item->node[sizeof(item->node) - 1] = '\0';
#   98|   	item->block = S_ISBLK(nvme_stat_info.st_mode);

Error: CPPCHECK_WARNING: [#def34]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/innogrit/innogrit-nvme.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING (CWE-457): [#def35]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/innogrit/innogrit-nvme.c:119: warning[uninitvar]: Uninitialized variables: peventlogadd.ms, peventlogadd.iindex
#  117|   	}
#  118|   
#  119|-> 	qsort(peventlogadd, icount, sizeof(struct eventlog_addindex), sort_eventlog_fn);
#  120|   
#  121|   	for (i = 0; i < icount; i++)

Error: GCC_ANALYZER_WARNING (CWE-688): [#def36]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/innogrit/innogrit-nvme.c: scope_hint: In function ‘setfilecontent’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/innogrit/innogrit-nvme.c:134:14: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fopen(filenamea, "a+")’ where non-null expected
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/innogrit/innogrit-nvme.c:2: included_from: Included from here.
/usr/include/stdio.h:735:15: note: argument 4 of ‘fwrite’ must be non-null
#  132|   		return true;
#  133|   	fp = fopen(filenamea, "a+");
#  134|-> 	rc = fwrite(buffer, 1, buffersize, fp);
#  135|   	fclose(fp);
#  136|   	if (rc != buffersize)

Error: CLANG_WARNING: [#def37]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/innogrit/innogrit-nvme.c:344:2: warning[deadcode.DeadStores]: Value stored to 'ivsctype' is never read
#  342|   	logtime = localtime(&timep);
#  343|   
#  344|-> 	ivsctype = 0;
#  345|   	ipackindex = 0;
#  346|   	memset(data, 0, 4096);

Error: CPPCHECK_WARNING: [#def38]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/inspur/inspur-nvme.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def39]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/intel/intel-nvme.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING (CWE-456): [#def40]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/intel/intel-nvme.c:1348: error[uninitdata]: Memory is allocated but not initialized: intel
# 1346|   	struct intel_vu_log *intel = malloc(sizeof(struct intel_vu_log));
# 1347|   	struct intel_vu_nlog *intel_nlog = (struct intel_vu_nlog *)buf;
# 1348|-> 	struct intel_assert_dump *ad = (struct intel_assert_dump *) intel->reserved;
# 1349|   	struct intel_event_header *ehdr = (struct intel_event_header *)intel->reserved;
# 1350|   	struct nvme_dev *dev;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def41]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/intel/intel-nvme.c: scope_hint: In function ‘get_internal_log’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/intel/intel-nvme.c:1420:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘intel’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null
# 1418|   	if (err)
# 1419|   		goto out;
# 1420|-> 	memcpy(intel, buf, sizeof(*intel));
# 1421|   
# 1422|   	/* for 1.1 Fultondales will use old nlog, but current assert/event */

Error: CPPCHECK_WARNING: [#def42]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-404): [#def43]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c: scope_hint: In function ‘parse_params’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:393:32: warning[-Wanalyzer-va-list-leak]: missing call to ‘va_end’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/ccan/ccan/str/str.h:8: included_from: Included from here.
nvme-cli-2.9.1-build/nvme-cli-2.9.1/ccan/ccan/list/list.h:7: included_from: Included from here.
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme-print.h:8: included_from: Included from here.
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:15: included_from: Included from here.
#  391|   			printf("No enough parameters. abort...\n");
#  392|   			va_end(argp);
#  393|-> 			return 1;
#  394|   		}
#  395|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def44]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c: scope_hint: In function ‘mb_high_latency_log_print’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:655:16: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen("log_c3.csv", "w+")’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:19: included_from: Included from here.
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:651:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:651:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:651:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:652:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:652:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:653:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:653:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:654:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:654:9: note: in expansion of macro ‘fPRINT_PARAM1’
#  653|   	fPRINT_PARAM1("Timestamp                        Type    QID    CID    NSID     StartLBA      NumLBA   Latency\n");
#  654|   	fPRINT_PARAM1("---------------------------------------------------------------------------------------------\n");
#  655|-> 	return 0;
#  656|   }
#  657|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def45]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:655:16: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen("log_c3.csv", "w+")’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:651:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:651:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:651:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:652:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:652:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:653:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:653:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:654:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:654:9: note: in expansion of macro ‘fPRINT_PARAM1’
#  653|   	fPRINT_PARAM1("Timestamp                        Type    QID    CID    NSID     StartLBA      NumLBA   Latency\n");
#  654|   	fPRINT_PARAM1("---------------------------------------------------------------------------------------------\n");
#  655|-> 	return 0;
#  656|   }
#  657|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def46]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:753:15: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen("log_c3.csv", "w+")’
#  751|   		return err;
#  752|   
#  753|-> 	fdi = fopen(FID_C3_LOG_FILENAME, "w+");
#  754|   
#  755|   	glp_high_latency_show_bar(fdi, DO_PRINT_FLAG);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def47]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:753:15: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen("log_c3.csv", "w+")’
#  751|   		return err;
#  752|   
#  753|-> 	fdi = fopen(FID_C3_LOG_FILENAME, "w+");
#  754|   
#  755|   	glp_high_latency_show_bar(fdi, DO_PRINT_FLAG);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def48]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:756:15: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen("log_c3.csv", "w+")’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:651:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:651:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:651:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:652:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:652:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:653:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:653:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:654:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:654:9: note: in expansion of macro ‘fPRINT_PARAM1’
#  754|   
#  755|   	glp_high_latency_show_bar(fdi, DO_PRINT_FLAG);
#  756|-> 	err = nvme_get_log_simple(dev_fd(dev), GLP_ID_VU_GET_HIGH_LATENCY_LOG, sizeof(buf), &buf);
#  757|   
#  758|   	while (1) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def49]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:756:15: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen("log_c3.csv", "w+")’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:651:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:651:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:651:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:652:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:652:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:653:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:653:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:654:9: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:654:9: note: in expansion of macro ‘fPRINT_PARAM1’
#  754|   
#  755|   	glp_high_latency_show_bar(fdi, DO_PRINT_FLAG);
#  756|-> 	err = nvme_get_log_simple(dev_fd(dev), GLP_ID_VU_GET_HIGH_LATENCY_LOG, sizeof(buf), &buf);
#  757|   
#  758|   	while (1) {

Error: GCC_ANALYZER_WARNING (CWE-775): [#def50]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c: scope_hint: In function ‘mb_selective_download’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:844:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(cfg.fw, 0)’
#  842|   	}
#  843|   
#  844|-> 	fw_fd = open(cfg.fw, O_RDONLY);
#  845|   	if (fw_fd < 0) {
#  846|   		fprintf(stderr, "no firmware file provided\n");

Error: GCC_ANALYZER_WARNING (CWE-688): [#def51]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c: scope_hint: In function ‘ioLatencyHistogramOutput’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:929:9: warning[-Wanalyzer-null-argument]: use of NULL ‘fd’ where non-null expected
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:945:9: note: in expansion of macro ‘fPRINT_PARAM2’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:945:9: note: in expansion of macro ‘fPRINT_PARAM2’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:945:9: note: in expansion of macro ‘fPRINT_PARAM2’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:946:9: note: in expansion of macro ‘fPRINT_PARAM2’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:946:9: note: in expansion of macro ‘fPRINT_PARAM2’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:950:17: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:950:17: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:950:17: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:951:17: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:951:17: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:952:17: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:952:17: note: in expansion of macro ‘fPRINT_PARAM1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/memblaze/memblaze-nvme.c:4: included_from: Included from here.
/usr/include/stdio.h:735:15: note: argument 4 of ‘fwrite’ must be non-null
#  927|   	len = snprintf(string, sizeof(string), "%-11d %-11s %-11s %-11u\n",
#  928|   		       index, subString0, subString1, pHistogram[index]);
#  929|-> 	fwrite(string, 1, len, fd);
#  930|   	if (print)
#  931|   		printf("%s", string);

Error: CPPCHECK_WARNING: [#def52]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/micron/micron-nvme.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def53]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/micron/micron-nvme.c:185:2: warning[deadcode.DeadStores]: Value stored to 'err' is never read
#  183|   	}
#  184|   
#  185|-> 	err = EINVAL;
#  186|   	nRet = system(strBuffer);
#  187|   

Error: CPPCHECK_WARNING (CWE-758): [#def54]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/micron/micron-nvme.c:1057: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 1055|   	/* For M51CX models, PCIe errors are cleared using 0xC3 feature */
# 1056|   	if (model == M51CX) {
# 1057|-> 		err = nvme_set_features_simple(dev_fd(dev), fid, 0, (1 << 31), false,
# 1058|   					       &result);
# 1059|   		if (!err)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def55]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/micron/micron-nvme.c: scope_hint: In function ‘GetTimestampInfo’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/micron/micron-nvme.c:1715:27: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*strOSDirName’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/micron/micron-nvme.c:4: included_from: Included from here.
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/micron/micron-nvme.c:3: included_from: Included from here.
/usr/include/string.h:187:14: note: argument 1 of ‘strdup’ must be a pointer to a null-terminated string
# 1713|   	num += sprintf((char *)(outstr + num), "\nPackage Version: 1.4");
# 1714|   	if (num) {
# 1715|-> 		strPDir = strdup(strOSDirName);
# 1716|   		strDest = dirname(strPDir);
# 1717|   		WriteData(outstr, num, strDest, "timestamp_info.txt", "timestamp");

Error: CLANG_WARNING: [#def56]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/micron/micron-nvme.c:1858:21: warning[deadcode.DeadStores]: Value stored to 'offset' during its initialization is never read
# 1856|   				int *logSize, int da)
# 1857|   {
# 1858|-> 	int err, bs = 512, offset = bs;
# 1859|   	unsigned short data_area[4];
# 1860|   	unsigned char  ctrl_init = (type == 0x8);

Error: CPPCHECK_WARNING (CWE-401): [#def57]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/micron/micron-nvme.c:1896: error[memleakOnRealloc]: Common realloc mistake: 'buffer' nulled but not freed upon failure
# 1894|   	offset = bs;
# 1895|   	err = 0;
# 1896|-> 	buffer = (unsigned char *)realloc(buffer, (size_t)(*logSize));
# 1897|   	if (buffer) {
# 1898|   		while (!err && offset != *logSize) {

Error: CPPCHECK_WARNING (CWE-758): [#def58]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/micron/micron-nvme.c:2729: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 2727|   	}
# 2728|   
# 2729|-> 	err = nvme_set_features_simple(dev_fd(dev), fid, 1 << 31, 0, 0, &result);
# 2730|   	if (!err)
# 2731|   		err = (int)result;

Error: CLANG_WARNING: [#def59]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/micron/micron-nvme.c:2938:23: warning[unix.MallocSizeof]: Result of 'malloc' is converted to a pointer of type 'uint8_t', which is incompatible with sizeof operand type 'struct micron_common_log_header'
# 2936|   	 */
# 2937|   	if (hdr.log_size == sizeof(hdr)) {
# 2938|-> 		buffer = (uint8_t *)malloc(sizeof(hdr));
# 2939|   		if (!buffer) {
# 2940|   			fprintf(stderr, "malloc of %zu bytes failed for log: 0x%X\n",

Error: CPPCHECK_WARNING: [#def60]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/nbft/nbft-plugin.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def61]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/netapp/netapp-nvme.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def62]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/netapp/netapp-nvme.c:426:2: warning[deadcode.DeadStores]: Value stored to 'err' is never read
#  424|   		return 0; /* not the right model of controller */
#  425|   
#  426|-> 	err = nvme_get_nsid(fd, &item->nsid);
#  427|   	err = nvme_identify_ns(fd, item->nsid, &item->ns);
#  428|   	if (err) {

Error: CLANG_WARNING: [#def63]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/netapp/netapp-nvme.c:458:2: warning[deadcode.DeadStores]: Value stored to 'err' is never read
#  456|   		return 0;
#  457|   
#  458|-> 	err = nvme_get_nsid(fd, &item->nsid);
#  459|   
#  460|   	err = nvme_identify_ns(fd, item->nsid, &item->ns);

Error: CPPCHECK_WARNING (CWE-758): [#def64]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/ocp/ocp-clear-features.c:19: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
#   17|   {
#   18|   	__u32 result = 0;
#   19|-> 	__u32 clear = 1 << 31;
#   20|   	struct nvme_dev *dev;
#   21|   	__u8 uuid_index = 0;

Error: CPPCHECK_WARNING: [#def65]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/ocp/ocp-fw-activation-history.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def66]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/ocp/ocp-nvme.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-835): [#def67]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/ocp/ocp-nvme.c: scope_hint: In function ‘print_telemetry_data_area_1’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/ocp/ocp-nvme.c:960:56: warning[-Wanalyzer-infinite-loop]: infinite loop
/usr/include/nvme/tree.h:20: included_from: Included from here.
/usr/include/nvme/mi.h:91: included_from: Included from here.
/usr/include/libnvme-mi.h:17: included_from: Included from here.
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.h:27: included_from: Included from here.
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/ocp/ocp-nvme.c:20: included_from: Included from here.
#  958|   		printf("Timestamp         : %"PRIu64"\n", le64_to_cpu(da1->timestamp));
#  959|   		for (i = 15; i >= 0; i--)
#  960|-> 			printf("%x", da1->log_page_guid[i]);
#  961|   		printf("Number Telemetry Profiles Supported         : 0x%x\n", da1->no_of_tps_supp);
#  962|   		printf("Telemetry Profile Selected (TPS)         : 0x%x\n", da1->tps);

Error: CPPCHECK_WARNING (CWE-823): [#def68]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/ocp/ocp-nvme.c:978: error[arrayIndexOutOfBounds]: Array 'da1->event_fifo_da[16]' accessed at index 16, which is out of bounds.
#  976|   			printf("reserved5         : 0x%x\n", da1->reserved5[i]);
#  977|   		for (i = 0; i < 17; i++){
#  978|-> 			printf("Event FIFO %d Data Area         : 0x%x\n", i, da1->event_fifo_da[i]);
#  979|   			printf("Event FIFO %d Start         : %"PRIu64"\n", i, le64_to_cpu(da1->event_fifo_start[i]));
#  980|   			printf("Event FIFO %d Size         : %"PRIu64"\n", i, le64_to_cpu(da1->event_fifo_size[i]));

Error: CPPCHECK_WARNING (CWE-823): [#def69]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/ocp/ocp-nvme.c:979: error[arrayIndexOutOfBounds]: Array 'da1->event_fifo_start[16]' accessed at index 16, which is out of bounds.
#  977|   		for (i = 0; i < 17; i++){
#  978|   			printf("Event FIFO %d Data Area         : 0x%x\n", i, da1->event_fifo_da[i]);
#  979|-> 			printf("Event FIFO %d Start         : %"PRIu64"\n", i, le64_to_cpu(da1->event_fifo_start[i]));
#  980|   			printf("Event FIFO %d Size         : %"PRIu64"\n", i, le64_to_cpu(da1->event_fifo_size[i]));
#  981|   		}

Error: CPPCHECK_WARNING (CWE-823): [#def70]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/ocp/ocp-nvme.c:980: error[arrayIndexOutOfBounds]: Array 'da1->event_fifo_size[16]' accessed at index 16, which is out of bounds.
#  978|   			printf("Event FIFO %d Data Area         : 0x%x\n", i, da1->event_fifo_da[i]);
#  979|   			printf("Event FIFO %d Start         : %"PRIu64"\n", i, le64_to_cpu(da1->event_fifo_start[i]));
#  980|-> 			printf("Event FIFO %d Size         : %"PRIu64"\n", i, le64_to_cpu(da1->event_fifo_size[i]));
#  981|   		}
#  982|   		for (i = 0; i < 80; i++)

Error: CPPCHECK_WARNING (CWE-823): [#def71]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/ocp/ocp-nvme.c:1194: error[arrayIndexOutOfBounds]: Array 'da1->event_fifo_da[16]' accessed at index 16, which is out of bounds.
# 1192|   	print_telemetry_da1_stat((void *)da1_stat, tele_type, (da1->da1_stat_size) * 4);
# 1193|   	for (i = 0; i < 17 ; i++){
# 1194|-> 		if (da1->event_fifo_da[i] == 1){
# 1195|   			char *da1_fifo = calloc((da1->event_fifo_size[i]) * 4, sizeof(char));
# 1196|   			err = get_telemetry_data(dev, nsid, tele_type, (da1->event_fifo_size[i]) * 4,

Error: CLANG_WARNING: [#def72]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/ocp/ocp-nvme.c:1199:12: warning[unix.Malloc]: Potential leak of memory pointed to by 'da1_fifo'
# 1197|   				(void *)da1_stat, lsp, rae, (da1->event_fifo_start[i]) * 4);
# 1198|   			if (err)
# 1199|-> 				return err;
# 1200|   			print_telemetry_da1_fifo((void *)da1_fifo, tele_type, (da1->event_fifo_size[i]) * 4);
# 1201|   		}

Error: CPPCHECK_WARNING (CWE-823): [#def73]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/ocp/ocp-nvme.c:1210: error[arrayIndexOutOfBounds]: Array 'da1->event_fifo_da[16]' accessed at index 16, which is out of bounds.
# 1208|   	print_telemetry_da2_stat((void *)da2_stat, tele_type, (da1->da2_stat_size) * 4);
# 1209|   	for (i = 0; i < 17 ; i++){
# 1210|-> 		if (da1->event_fifo_da[i] == 2){
# 1211|   			char *da1_fifo = calloc((da1->event_fifo_size[i]) * 4, sizeof(char));
# 1212|   			err = get_telemetry_data(dev, nsid, tele_type, (da1->event_fifo_size[i]) * 4,

Error: CPPCHECK_WARNING: [#def74]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/scaleflux/sfx-nvme.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-775): [#def75]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/scaleflux/sfx-nvme.c: scope_hint: In function ‘nvme_dump_evtlog’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/scaleflux/sfx-nvme.c:1279:17: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(file, "rb")’
# 1277|   	fd = fopen(output, "w+");
# 1278|   	if (!fd) {
# 1279|-> 		fprintf(stderr, "Failed to open %s file to write\n", output);
# 1280|   		err = ENOENT;
# 1281|   		goto ret;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def76]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/scaleflux/sfx-nvme.c:1279:17: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(file, "rb")’
# 1277|   	fd = fopen(output, "w+");
# 1278|   	if (!fd) {
# 1279|-> 		fprintf(stderr, "Failed to open %s file to write\n", output);
# 1280|   		err = ENOENT;
# 1281|   		goto ret;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def77]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/scaleflux/sfx-nvme.c:1285:72: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(file, "rb")’
# 1283|   
# 1284|   	while (length > 0) {
# 1285|-> 		info = (struct sfx_nvme_evtlog_info *)(pevent_log_info + offset);
# 1286|   
# 1287|   		if ((info->magic1 == 0x474F4C545645) &&

Error: GCC_ANALYZER_WARNING (CWE-401): [#def78]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/scaleflux/sfx-nvme.c:1285:72: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(file, "rb")’
# 1283|   
# 1284|   	while (length > 0) {
# 1285|-> 		info = (struct sfx_nvme_evtlog_info *)(pevent_log_info + offset);
# 1286|   
# 1287|   		if ((info->magic1 == 0x474F4C545645) &&

Error: CLANG_WARNING: [#def79]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/scaleflux/sfx-nvme.c:1387:11: warning[unix.MallocSizeof]: Result of 'calloc' is converted to a pointer of type 'struct nvme_persistent_event_log', which is incompatible with sizeof operand type '__u8'
# 1385|   	}
# 1386|   
# 1387|-> 	pevent = calloc(sizeof(*pevent), sizeof(__u8));
# 1388|   	if (!pevent) {
# 1389|   		err = -ENOMEM;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def80]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/scaleflux/sfx-nvme.c:1420:14: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(file, "wb+")’
# 1418|   	}
# 1419|   
# 1420|-> 	fd = fopen(file, "wb+");
# 1421|   	if (!fd) {
# 1422|   		fprintf(stderr, "Failed to open %s file to write\n", file);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def81]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/scaleflux/sfx-nvme.c:1420:14: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(file, "wb+")’
# 1418|   	}
# 1419|   
# 1420|-> 	fd = fopen(file, "wb+");
# 1421|   	if (!fd) {
# 1422|   		fprintf(stderr, "Failed to open %s file to write\n", file);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def82]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/scaleflux/sfx-nvme.c:1431:26: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(file, "wb+")’
# 1429|   	length = log_len;
# 1430|   	while (length > 0) {
# 1431|-> 		args.lpo = offset;
# 1432|   		if (length > single_len) {
# 1433|   			args.len = single_len;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def83]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/scaleflux/sfx-nvme.c:1431:26: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(file, "wb+")’
# 1429|   	length = log_len;
# 1430|   	while (length > 0) {
# 1431|-> 		args.lpo = offset;
# 1432|   		if (length > single_len) {
# 1433|   			args.len = single_len;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def84]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/scaleflux/sfx-nvme.c:1454:9: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(file, "wb+")’
# 1452|   	}
# 1453|   
# 1454|-> 	printf("\nDump-evtlog: Success\n");
# 1455|   
# 1456|   	if (parse) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def85]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/scaleflux/sfx-nvme.c:1454:9: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(file, "wb+")’
# 1452|   	}
# 1453|   
# 1454|-> 	printf("\nDump-evtlog: Success\n");
# 1455|   
# 1456|   	if (parse) {

Error: GCC_ANALYZER_WARNING (CWE-775): [#def86]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/scaleflux/sfx-nvme.c:1457:17: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(file, "wb+")’
# 1455|   
# 1456|   	if (parse) {
# 1457|-> 		nvme_free_huge(&mh);
# 1458|   		pevent_log_info = nvme_alloc_huge(log_len, &mh);
# 1459|   		if (!pevent_log_info) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def87]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/scaleflux/sfx-nvme.c:1457:17: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(file, "wb+")’
# 1455|   
# 1456|   	if (parse) {
# 1457|-> 		nvme_free_huge(&mh);
# 1458|   		pevent_log_info = nvme_alloc_huge(log_len, &mh);
# 1459|   		if (!pevent_log_info) {

Error: GCC_ANALYZER_WARNING (CWE-775): [#def88]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/scaleflux/sfx-nvme.c:1458:35: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(file, "wb+")’
# 1456|   	if (parse) {
# 1457|   		nvme_free_huge(&mh);
# 1458|-> 		pevent_log_info = nvme_alloc_huge(log_len, &mh);
# 1459|   		if (!pevent_log_info) {
# 1460|   			fprintf(stderr, "Failed to alloc enough memory 0x%x to parse evtlog\n", log_len);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def89]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/scaleflux/sfx-nvme.c:1458:35: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(file, "wb+")’
# 1456|   	if (parse) {
# 1457|   		nvme_free_huge(&mh);
# 1458|-> 		pevent_log_info = nvme_alloc_huge(log_len, &mh);
# 1459|   		if (!pevent_log_info) {
# 1460|   			fprintf(stderr, "Failed to alloc enough memory 0x%x to parse evtlog\n", log_len);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def90]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/scaleflux/sfx-nvme.c:1466:22: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(file, "rb")’
# 1464|   
# 1465|   		fclose(fd);
# 1466|-> 		fd = fopen(file, "rb");
# 1467|   		if (!fd) {
# 1468|   			fprintf(stderr, "Failed to open %s file to read\n", file);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def91]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/scaleflux/sfx-nvme.c:1466:22: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(file, "rb")’
# 1464|   
# 1465|   		fclose(fd);
# 1466|-> 		fd = fopen(file, "rb");
# 1467|   		if (!fd) {
# 1468|   			fprintf(stderr, "Failed to open %s file to read\n", file);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def92]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/scaleflux/sfx-nvme.c:1472:21: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(file, "rb")’
# 1470|   			goto free_pevent;
# 1471|   		}
# 1472|-> 		if (fread(pevent_log_info, 1, log_len, fd) != log_len) {
# 1473|   			fprintf(stderr, "Failed to read evtlog to buffer\n");
# 1474|   			goto close_fd;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def93]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/scaleflux/sfx-nvme.c:1472:21: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(file, "rb")’
# 1470|   			goto free_pevent;
# 1471|   		}
# 1472|-> 		if (fread(pevent_log_info, 1, log_len, fd) != log_len) {
# 1473|   			fprintf(stderr, "Failed to read evtlog to buffer\n");
# 1474|   			goto close_fd;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def94]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/scaleflux/sfx-nvme.c:1473:25: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(file, "rb")’
# 1471|   		}
# 1472|   		if (fread(pevent_log_info, 1, log_len, fd) != log_len) {
# 1473|-> 			fprintf(stderr, "Failed to read evtlog to buffer\n");
# 1474|   			goto close_fd;
# 1475|   		}

Error: GCC_ANALYZER_WARNING (CWE-401): [#def95]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/scaleflux/sfx-nvme.c:1473:25: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(file, "rb")’
# 1471|   		}
# 1472|   		if (fread(pevent_log_info, 1, log_len, fd) != log_len) {
# 1473|-> 			fprintf(stderr, "Failed to read evtlog to buffer\n");
# 1474|   			goto close_fd;
# 1475|   		}

Error: CPPCHECK_WARNING: [#def96]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/seagate/seagate-nvme.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def97]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/seagate/seagate-nvme.c:1541:3: warning[deadcode.DeadStores]: Value stored to 'err' is never read
# 1539|   
# 1540|   	if (!stx_is_jag_pan(modelNo)) {
# 1541|-> 		err = nvme_set_features_simple(dev_fd(dev), 0xE1, 0, 0xCB, cfg.save, &result);
# 1542|   	} else {
# 1543|   		struct nvme_set_features_args args = {

Error: CPPCHECK_WARNING: [#def98]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/sed/sedopal_cmd.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-688): [#def99]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/sed/sedopal_cmd.c: scope_hint: In function ‘sedopal_set_key’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/sed/sedopal_cmd.c:145:29: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/sed/sedopal_cmd.c:7: included_from: Included from here.
/usr/include/string.h:159:12: note: argument 2 of ‘strncmp’ must be non-null
#  143|   		if (sedopal_ask_new_key) {
#  144|   			pass = sedopal_get_password(SEDOPAL_REENTER_PW_PROMPT);
#  145|-> 			if (strncmp((char *)key->key, pass, key->key_len)) {
#  146|   				fprintf(stderr,
#  147|   					"Error: passwords don't match\n");

Error: CPPCHECK_WARNING: [#def100]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/shannon/shannon-nvme.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-775): [#def101]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/shannon/shannon-nvme.c: scope_hint: In function ‘set_additional_feature’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/shannon/shannon-nvme.c:309:24: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘ffd’
#  307|   	err = parse_and_open(&dev, argc, argv, desc, opts);
#  308|   	if (err)
#  309|-> 		return err;
#  310|   
#  311|   	if (!cfg.feature_id) {

Error: GCC_ANALYZER_WARNING (CWE-775): [#def102]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/shannon/shannon-nvme.c:329:28: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(cfg.file, 0)’
#  327|   		if (strlen(cfg.file)) {
#  328|   			ffd = open(cfg.file, O_RDONLY);
#  329|-> 			if (ffd <= 0) {
#  330|   				fprintf(stderr, "no firmware file provided\n");
#  331|   				err = EINVAL;

Error: GCC_ANALYZER_WARNING: [#def103]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/shannon/shannon-nvme.c:335:23: warning[-Wanalyzer-fd-use-without-check]: ‘read’ on possibly invalid file descriptor ‘ffd’
#  333|   			}
#  334|   		}
#  335|-> 		err = read(ffd, (void *)buf, cfg.data_len);
#  336|   		if (err < 0) {
#  337|   			fprintf(stderr, "failed to read data buffer from input file\n");

Error: CPPCHECK_WARNING: [#def104]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-garbage-collection.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def105]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-get-drive-info.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def106]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-internal-logs.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING (CWE-457): [#def107]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-internal-logs.c:390: warning[uninitvar]: Uninitialized variable: nlog_header->totalnlogs
#  388|   				return err;
#  389|   			}
#  390|-> 			count = nlog_header->totalnlogs;
#  391|   			core_num = core < 0 ? nlog_header->corecount : 0;
#  392|   			if (!header_size) {

Error: CPPCHECK_WARNING: [#def108]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-latency-tracking.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def109]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-latency-tracking.c:161:32: warning[core.BitwiseShift]: Right operand is negative in left shift
#  159|   	int k = i % base_val;
#  160|   
#  161|-> 	return base + ((k + 0.5) * (1 << error_bits));
#  162|   }
#  163|   

Error: CPPCHECK_WARNING: [#def110]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-log-page-dir.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def111]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-smart.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-457): [#def112]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-telemetry.c: scope_hint: In function ‘solidigm_get_telemetry_log’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-telemetry.c:148:23: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘dev’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-telemetry.c:9: included_from: Included from here.
#  146|   		size_t max_data_tx;
#  147|   
#  148|-> 		err = nvme_get_telemetry_max(dev_fd(dev), NULL, &max_data_tx);
#  149|   		if (err < 0) {
#  150|   			SOLIDIGM_LOG_WARNING("identify_ctrl: %s",

Error: GCC_ANALYZER_WARNING (CWE-457): [#def113]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-telemetry.c:182:26: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘dev’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-telemetry.c:20: included_from: Included from here.
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-telemetry.c:114:17: note: in expansion of macro ‘SOLIDIGM_LOG_WARNING’
#  180|   	if (!cfg.is_input_file) {
#  181|   		/* Redundant close() to make static code analysis happy */
#  182|-> 		close(dev->direct.fd);
#  183|   		dev_close(dev);
#  184|   	}

Error: CPPCHECK_WARNING: [#def114]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-telemetry/cod.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def115]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-telemetry/data-area.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-457): [#def116]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-telemetry/data-area.c: scope_hint: In function ‘telemetry_log_structure_parse’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-telemetry/data-area.c:173:26: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘array_size_dimension[0]’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-telemetry/telemetry-log.h:12: included_from: Included from here.
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-telemetry/header.h:8: included_from: Included from here.
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-telemetry/data-area.c:9: included_from: Included from here.
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-telemetry/data-area.c:465:17: note: in expansion of macro ‘json_object_add_value_array’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-telemetry/data-area.c:395:28: note: in expansion of macro ‘json_create_object’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-telemetry/data-area.c:422:53: note: in expansion of macro ‘json_create_object’
#  171|   	}
#  172|   	if (array_rank > 1) {
#  173|-> 		uint32_t linear_pos_per_index = array_size_dimension[0];
#  174|   		uint32_t prev_index_offset_bit = 0;
#  175|   		struct json_object *dimension_output;

Error: CLANG_WARNING: [#def117]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-telemetry/data-area.c:270:11: warning[deadcode.DeadStores]: Value stored to 'last_block' during its initialization is never read
#  268|   {
#  269|   	uint32_t offset_blocks = 1;
#  270|-> 	uint32_t last_block = tl->log->dalb1;
#  271|   	uint32_t last;
#  272|   

Error: CPPCHECK_WARNING: [#def118]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-telemetry/nlog.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING (CWE-457): [#def119]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-telemetry/nlog.c:124: warning[uninitvar]: Uninitialized variable: str_mismatches
#  122|   				       offset_tail_mismatches[best_offset][i]);
#  123|   
#  124|-> 		SOLIDIGM_LOG_WARNING("%s:%d with %d header mismatches ( %s). Configuration file may be missing format headers.",
#  125|   				      name, media_bank, smaller_tail_count, str_mismatches);
#  126|   	}

Error: CPPCHECK_WARNING: [#def120]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/toshiba/toshiba-nvme.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def121]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/virtium/virtium-nvme.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def122]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/wdc/wdc-nvme.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def123]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/wdc/wdc-nvme.c:1514:2: warning[deadcode.DeadStores]: Value stored to 'ret' is never read
# 1512|   
# 1513|   	*vendor_id = strtol(id, NULL, 0);
# 1514|-> 	ret = 0;
# 1515|   
# 1516|   	fd = open(did, O_RDONLY);

Error: CLANG_WARNING: [#def124]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/wdc/wdc-nvme.c:2364:34: warning[core.NullDereference]: Access to field 'length' results in a dereference of a null pointer (loaded from variable 'sph')
# 2362|   	found = wdc_get_dev_mng_log_entry(le32_to_cpu(hdr_ptr->length), log_id, hdr_ptr, &sph);
# 2363|   	if (found) {
# 2364|-> 		*cbs_data = calloc(le32_to_cpu(sph->length), sizeof(__u8));
# 2365|   		if (!*cbs_data) {
# 2366|   			fprintf(stderr, "ERROR: WDC: calloc: %s\n", strerror(errno));

Error: CLANG_WARNING: [#def125]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/wdc/wdc-nvme.c:2874:2: warning[deadcode.DeadStores]: Value stored to 'data_written' is never read
# 2872|   	 *block.
# 2873|   	 */
# 2874|-> 	data_written = 0;
# 2875|   	data_remaining = full_size;
# 2876|   	data_ptr = (__u8 *)log;

Error: CLANG_WARNING: [#def126]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/wdc/wdc-nvme.c:2882:4: warning[deadcode.DeadStores]: Value stored to 'data_remaining' is never read
# 2880|   
# 2881|   		if (data_written < 0) {
# 2882|-> 			data_remaining = data_written;
# 2883|   			break;
# 2884|   		} else if (data_written <= data_remaining) {

Error: CLANG_WARNING: [#def127]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/wdc/wdc-nvme.c:5941:42: warning[unix.MallocSizeof]: Result of 'malloc' is converted to a pointer of type 'struct wdc_nvme_hw_rev_log', which is incompatible with sizeof operand type '__u8'
# 5939|   	struct wdc_nvme_hw_rev_log *log_ptr = NULL;
# 5940|   
# 5941|-> 	log_ptr = (struct wdc_nvme_hw_rev_log *)malloc(sizeof(__u8) * WDC_NVME_HW_REV_LOG_PAGE_LEN);
# 5942|   	if (!log_ptr) {
# 5943|   		fprintf(stderr, "ERROR: WDC: malloc: %s\n", strerror(errno));

Error: CLANG_WARNING: [#def128]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/wdc/wdc-nvme.c:7015:2: warning[deadcode.DeadStores]: Value stored to 'ret' is never read
# 7013|   	}
# 7014|   
# 7015|-> 	ret = wdc_get_pci_ids(r, dev, &device_id, &read_vendor_id);
# 7016|   
# 7017|   	switch (device_id) {

Error: CLANG_WARNING: [#def129]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/wdc/wdc-nvme.c:7325:2: warning[deadcode.DeadStores]: Value stored to 'ret' is never read
# 7323|   	}
# 7324|   
# 7325|-> 	ret = wdc_get_pci_ids(r, dev, &read_device_id, &read_vendor_id);
# 7326|   
# 7327|   	switch (read_device_id) {

Error: CPPCHECK_WARNING (CWE-758): [#def130]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/wdc/wdc-nvme.c:8707: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 8705|   	int ret;
# 8706|   	__u32 result;
# 8707|-> 	__u32 value = 1 << 31; /* Bit 31 - clear PCIe correctable count */
# 8708|   
# 8709|   	ret = nvme_set_features_simple(fd, WDC_NVME_CLEAR_PCIE_CORR_FEATURE_ID, 0, value,

Error: CLANG_WARNING: [#def131]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/wdc/wdc-nvme.c:9033:2: warning[deadcode.DeadStores]: Value stored to 'ret' is never read
# 9031|   	}
# 9032|   
# 9033|-> 	ret = wdc_get_pci_ids(r, dev, &device_id, &vendor_id);
# 9034|   
# 9035|   	data = (__u8 *)malloc(sizeof(__u8) * WDC_FW_ACT_HISTORY_C2_LOG_BUF_LEN);

Error: CPPCHECK_WARNING (CWE-758): [#def132]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/wdc/wdc-nvme.c:9179: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 9177|   	int ret = -1;
# 9178|   	__u32 result;
# 9179|-> 	__u32 value = 1 << 31; /* Bit 31 - Clear Firmware Update History Log */
# 9180|   
# 9181|   	ret = nvme_set_features_simple(fd, WDC_NVME_CLEAR_FW_ACT_HIST_VU_FID, 0, value,

Error: CLANG_WARNING: [#def133]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/wdc/wdc-nvme.c:9995:2: warning[deadcode.DeadStores]: Value stored to 'ret' is never read
# 9993|   	}
# 9994|   
# 9995|-> 	ret = wdc_read_debug_directory(dev, bufferFolderPath, serialNo, timeString);
# 9996|   
# 9997|   	/* Get Dump Trace Data */

Error: CLANG_WARNING: [#def134]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/wdc/wdc-nvme.c:10556:23: warning[core.UndefinedBinaryOperatorResult]: The left operand of '==' is a garbage value
#10554|   
#10555|   		ret = wdc_get_pci_ids(r, dev, &device_id, &read_vendor_id);
#10556|-> 		log_id = (device_id == WDC_NVME_ZN350_DEV_ID ||
#10557|   			  device_id == WDC_NVME_ZN350_DEV_ID_1) ?
#10558|   			WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_ID_C8 :

Error: CLANG_WARNING: [#def135]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/wdc/wdc-nvme.c:12093:16: warning[unix.MallocSizeof]: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type '__u8'
#12091|   	char *buf;
#12092|   
#12093|-> 	buf = (char *)malloc(sizeof(__u8) * xfer_size);
#12094|   	if (!buf) {
#12095|   		fprintf(stderr, "%s: ERROR: malloc: %s\n", __func__, strerror(errno));

Error: CPPCHECK_WARNING: [#def136]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/zns/zns.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def137]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/util/argconfig.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def138]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/util/base64.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-775): [#def139]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/util/cleanup.h:18:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘ffd’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.h:105:15: note: in expansion of macro ‘DEFINE_CLEANUP_FUNC’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.c: scope_hint: In function ‘dir_send’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.h:105:15: note: in expansion of macro ‘DEFINE_CLEANUP_FUNC’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/nvme.h:105:15: note: in expansion of macro ‘DEFINE_CLEANUP_FUNC’
#   16|   DECLARE_CLEANUP_FUNC(name, type)		\
#   17|   {						\
#   18|-> 	if (*__p)				\
#   19|   		free_fn(*__p);			\
#   20|   }

Error: GCC_ANALYZER_WARNING (CWE-1341): [#def140]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/util/cleanup.h:33:17: warning[-Wanalyzer-fd-double-close]: double ‘close’ of file descriptor ‘open(&file_path, 577, 420)’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-internal-logs.c: scope_hint: In function ‘dump_telemetry’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/plugins/solidigm/solidigm-internal-logs.c: scope_hint: In function ‘dump_telemetry’
#   31|   {
#   32|   	if (*f > STDERR_FILENO)
#   33|-> 		close(*f);
#   34|   }
#   35|   #define _cleanup_file_ __cleanup__(close_file)

Error: GCC_ANALYZER_WARNING (CWE-688): [#def141]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/util/mem.c: scope_hint: In function ‘nvme_realloc’
nvme-cli-2.9.1-build/nvme-cli-2.9.1/util/mem.c:34:17: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected
<built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null
#   32|   
#   33|   	if (p) {
#   34|-> 		memcpy(result, p, min(old_len, len));
#   35|   		free(p);
#   36|   	}

Error: CPPCHECK_WARNING: [#def142]
nvme-cli-2.9.1-build/nvme-cli-2.9.1/util/suffix.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Scan Properties

analyzer-version-clang18.1.7
analyzer-version-cppcheck2.14.2
analyzer-version-gcc14.1.1
analyzer-version-gcc-analyzer14.1.1
analyzer-version-shellcheck0.10.0
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-19.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-namenvme-cli-2.9.1-2.fc41
store-results-to/tmp/tmpjalszmwd/nvme-cli-2.9.1-2.fc41.tar.xz
time-created2024-07-03 16:24:43
time-finished2024-07-03 16:27:00
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpjalszmwd/nvme-cli-2.9.1-2.fc41.tar.xz' '--gcc-analyze' '/tmp/tmpjalszmwd/nvme-cli-2.9.1-2.fc41.src.rpm'
tool-versioncsmock-3.5.3-1.el9