HomeFreeBSD

fusefs: coverity cleanup in the tests

Description

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

Details

Committed
asomersSep 6 2019, 7:50 PM
Reviewer
emaste
Differential Revision
D21457: fusefs: coverity cleanup in the tests
Parents
rS351962: MFC r350556:
Branches
Unknown
Tags
Unknown