diff options
author | Alan Somers <asomers@FreeBSD.org> | 2019-09-06 19:50:45 +0000 |
---|---|---|
committer | Alan Somers <asomers@FreeBSD.org> | 2019-09-06 19:50:45 +0000 |
commit | 8e7657374aa215ec065d2f76753d799136a3c0cb (patch) | |
tree | 46af38c48ed8d402fbe0e7eee04537ccf9500c86 /tests/sys/fs/fusefs/release.cc | |
parent | 16f87834521ed255d8412b88b9f4b27d3ec28ef1 (diff) | |
download | src-8e7657374aa215ec065d2f76753d799136a3c0cb.tar.gz src-8e7657374aa215ec065d2f76753d799136a3c0cb.zip |
fusefs: coverity cleanup in the tests
Address the following defects reported by Coverity:
* Structurally dead code (CID 1404366): set m_quit before FAIL, not after
* Unchecked return value of sysctlbyname (CID 1404321)
* Unchecked return value of stat(2) (CID 1404471)
* Unchecked return value of open(2) (CID 1404402, 1404529)
* Unchecked return value of dup(2) (CID 1404478)
* Buffer overflows. These are all false positives caused by the fact that
Coverity thinks I'm using a buffer to store strings, when in fact I'm
really just using it to store a byte array that happens to be initialized
with a string. I'm changing the type from char to uint8_t in the hopes
that it will placate Coverity. (CID 1404338, 1404350, 1404367, 1404376,
1404379, 1404381, 1404388, 1404403, 1404425, 1404433, 1404434, 1404474,
1404480, 1404484, 1404503, 1404505)
* False positive file descriptor leak. I'm going to try to fix this with
Coverity modeling, but I'll also change an EXPECT to ASSERT so we don't
perform meaningless assertions after the failure. (CID 1404320, 1404324,
1404440, 1404445).
* Unannotated file descriptor leak. This will be followed up by a Coverity
modeling change. (CID 1404326, 1404334, 1404336, 1404357, 1404361,
1404372, 1404391, 1404395, 1404409, 1404430, 1404448, 1404451, 1404455,
1404457, 1404458, 1404460)
* Uninitialized variables in C++ constructors (CID 1404327, 1404346). In the
case of m_maxphys, this actually led to part of the FUSE_INIT's response
being set to stack garbage during the WriteCluster::clustering test.
* Uninitialized sun_len field in struct sockaddr_un (CID 1404330, 1404371,
1404429).
Reported by: Coverity
Reviewed by: emaste
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21457
Notes
Notes:
svn path=/head/; revision=351963
Diffstat (limited to 'tests/sys/fs/fusefs/release.cc')
-rw-r--r-- | tests/sys/fs/fusefs/release.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/sys/fs/fusefs/release.cc b/tests/sys/fs/fusefs/release.cc index f737a5c6655e..8953f4da15df 100644 --- a/tests/sys/fs/fusefs/release.cc +++ b/tests/sys/fs/fusefs/release.cc @@ -90,6 +90,7 @@ TEST_F(Release, dup) EXPECT_LE(0, fd) << strerror(errno); fd2 = dup(fd); + ASSERT_LE(0, fd2) << strerror(errno); ASSERT_EQ(0, close(fd2)) << strerror(errno); ASSERT_EQ(0, close(fd)) << strerror(errno); |