Fixed defects

List of Defects

Error: CLANG_WARNING: [#def1]
nvme-cli-2.8-build/nvme-cli-2.8/fabrics.c:229:2: warning[core.StackAddressEscape]: Address of stack memory associated with local variable 'id' is still referred to by the stack variable 'trcfg' upon returning to the caller.  This will be a dangling reference
#  227|   
#  228|   	trcfg->subsysnqn = id.subnqn;
#  229|-> 	return __create_discover_ctrl(r, h, cfg, trcfg);
#  230|   }
#  231|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
nvme-cli-2.8-build/nvme-cli-2.8/fabrics.c: scope_hint: In function ‘nvmf_check_hostid_and_hostnqn.part.0’
nvme-cli-2.8-build/nvme-cli-2.8/fabrics.c:634:16: warning[-Wanalyzer-malloc-leak]: leak of ‘nvmf_hostid_from_hostnqn(hostnqn)’
#  632|   		return NULL;
#  633|   
#  634|-> 	return strdup(uuid + strlen("uuid:"));
#  635|   }
#  636|   

Error: GCC_ANALYZER_WARNING (CWE-457): [#def3]
nvme-cli-2.8-build/nvme-cli-2.8/nvme-print-json.c: scope_hint: In function ‘json_phy_rx_eom_log’
nvme-cli-2.8-build/nvme-cli-2.8/nvme-print-json.c:2046:43: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*<unknown>’
nvme-cli-2.8-build/nvme-cli-2.8/nvme.h:30: included_from: Included from here.
nvme-cli-2.8-build/nvme-cli-2.8/nvme-print.h:5: included_from: Included from here.
nvme-cli-2.8-build/nvme-cli-2.8/nvme-print-json.c:7: included_from: Included from here.
nvme-cli-2.8-build/nvme-cli-2.8/nvme-print-json.c:1987:45: note: in expansion of macro ‘json_create_object’
nvme-cli-2.8-build/nvme-cli-2.8/nvme-print-json.c:1969:9: note: in expansion of macro ‘obj_add_str’
nvme-cli-2.8-build/nvme-cli-2.8/nvme-print-json.c:1969:9: note: in expansion of macro ‘obj_add_str’
# 2044|   		for (i = 0; i < log->nd; i++) {
# 2045|   			/* Free any Printable Eye strings allocated */
# 2046|-> 			if (allocated_eyes[i])
# 2047|   				free(allocated_eyes[i]);
# 2048|   		}

Error: GCC_ANALYZER_WARNING (CWE-457): [#def4]
nvme-cli-2.8-build/nvme-cli-2.8/nvme.c: scope_hint: In function ‘get_feature_id_changed’
nvme-cli-2.8-build/nvme-cli-2.8/nvme.c:4587:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘result’
# 4585|   	if (err || !changed || err_def || result != result_def ||
# 4586|   	    (buf && buf_def && !strcmp(buf, buf_def)))
# 4587|-> 		get_feature_id_print(cfg, err, result, buf);
# 4588|   
# 4589|   	free(buf);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def5]
nvme-cli-2.8-build/nvme-cli-2.8/nvme.c: scope_hint: In function ‘fw_download’
nvme-cli-2.8-build/nvme-cli-2.8/nvme.c:4856:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(cfg.fw, 0)’
# 4854|   		return err;
# 4855|   
# 4856|-> 	fw_fd = open(cfg.fw, O_RDONLY);
# 4857|   	cfg.offset <<= 2;
# 4858|   	if (fw_fd < 0) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def6]
nvme-cli-2.8-build/nvme-cli-2.8/nvme.c: scope_hint: In function ‘gen_dhchap_key’
nvme-cli-2.8-build/nvme-cli-2.8/nvme.c:8394:24: warning[-Wanalyzer-malloc-leak]: leak of ‘raw_secret’
# 8392|   	err = argconfig_parse(argc, argv, desc, opts);
# 8393|   	if (err)
# 8394|-> 		return err;
# 8395|   
# 8396|   	if (cfg.hmac > 3) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def7]
nvme-cli-2.8-build/nvme-cli-2.8/nvme.c: scope_hint: In function ‘gen_tls_key’
nvme-cli-2.8-build/nvme-cli-2.8/nvme.c:8627:24: warning[-Wanalyzer-malloc-leak]: leak of ‘raw_secret’
# 8625|   	err = argconfig_parse(argc, argv, desc, opts);
# 8626|   	if (err)
# 8627|-> 		return err;
# 8628|   	if (cfg.hmac < 1 || cfg.hmac > 2) {
# 8629|   		nvme_show_error("Invalid HMAC identifier %u", cfg.hmac);

Error: CLANG_WARNING: [#def8]
nvme-cli-2.8-build/nvme-cli-2.8/plugins/sed/sedopal_cmd.c:505:3: warning[core.CallAndMessage]: 1st function call argument is an uninitialized value
#  503|   		rc = -1;
#  504|   	} else
#  505|-> 		sedopal_print_locking_features(locking_flags);
#  506|   
#  507|   	return rc;

Error: GCC_ANALYZER_WARNING (CWE-457): [#def9]
nvme-cli-2.8-build/nvme-cli-2.8/plugins/sed/sedopal_cmd.c: scope_hint: In function ‘sedopal_cmd_discover’
nvme-cli-2.8-build/nvme-cli-2.8/plugins/sed/sedopal_cmd.c:505:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘locking_flags’
/usr/include/sys/types.h:176: included_from: Included from here.
nvme-cli-2.8-build/nvme-cli-2.8/plugins/sed/sedopal_cmd.c:10: included_from: Included from here.
#  503|   		rc = -1;
#  504|   	} else
#  505|-> 		sedopal_print_locking_features(locking_flags);
#  506|   
#  507|   	return rc;

Error: COMPILER_WARNING (CWE-457): [#def10]
nvme-cli-2.8-build/nvme-cli-2.8/plugins/sed/sedopal_cmd.c: scope_hint: In function ‘sedopal_cmd_discover’
nvme-cli-2.8-build/nvme-cli-2.8/plugins/sed/sedopal_cmd.c:505:17: warning[-Wmaybe-uninitialized]: ‘locking_flags’ may be used uninitialized
#  505 |                 sedopal_print_locking_features(locking_flags);
#      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nvme-cli-2.8-build/nvme-cli-2.8/plugins/sed/sedopal_cmd.c:458:17: note: ‘locking_flags’ was declared here
#  458 |         uint8_t locking_flags;
#      |                 ^~~~~~~~~~~~~
#  503|   		rc = -1;
#  504|   	} else
#  505|-> 		sedopal_print_locking_features(locking_flags);
#  506|   
#  507|   	return rc;

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