Fixed findings

List of Findings

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

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
libnvme-1.10-build/libnvme-1.10/src/nvme/linux.c: scope_hint: In function ‘nvme_get_attr’
libnvme-1.10-build/libnvme-1.10/src/nvme/linux.c:487:30: warning[-Wanalyzer-malloc-leak]: leak of ‘__nvme_get_attr(path)’
#  485|   	if (value[strlen(value) - 1] == '\n')
#  486|   		value[strlen(value) - 1] = '\0';
#  487|-> 	while (strlen(value) > 0 && value[strlen(value) - 1] == ' ')
#  488|   		value[strlen(value) - 1] = '\0';
#  489|   

Error: CPPCHECK_WARNING (CWE-758): [#def3]
libnvme-1.10-build/libnvme-1.10/src/nvme/types.h:1550: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 1548|   	NVME_CTRL_OAES_NS			= 1 << 15,
# 1549|   	NVME_CTRL_OAES_ZD			= 1 << 27,
# 1550|-> 	NVME_CTRL_OAES_DL			= 1 << 31,
# 1551|   };
# 1552|   

Scan Properties

analyzer-version-clippy1.82.0
analyzer-version-cppcheck2.16.0
analyzer-version-gcc14.2.1
analyzer-version-gcc-analyzer15.0.0
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.82.0
diffbase-analyzer-version-cppcheck2.16.0
diffbase-analyzer-version-gcc14.2.1
diffbase-analyzer-version-gcc-analyzer15.0.0
diffbase-analyzer-version-shellcheck0.10.0
diffbase-analyzer-version-unicontrol0.0.2
diffbase-enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code0
diffbase-hostip-172-16-1-189.us-west-2.compute.internal
diffbase-mock-configfedora-rawhide-gcc-latest-x86_64
diffbase-project-namelibnvme-1.11-1.fc42
diffbase-store-results-to/tmp/tmputj_65gk/libnvme-1.11-1.fc42.tar.xz
diffbase-time-created2024-11-13 01:38:26
diffbase-time-finished2024-11-13 01:41:14
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmputj_65gk/libnvme-1.11-1.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmputj_65gk/libnvme-1.11-1.fc42.src.rpm'
diffbase-tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-189.us-west-2.compute.internal
mock-configfedora-rawhide-gcc-latest-x86_64
project-namelibnvme-1.10-1.fc41
store-results-to/tmp/tmp9dx3qs_f/libnvme-1.10-1.fc41.tar.xz
time-created2024-11-13 01:35:00
time-finished2024-11-13 01:38:02
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmp9dx3qs_f/libnvme-1.10-1.fc41.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmp9dx3qs_f/libnvme-1.10-1.fc41.src.rpm'
tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9