Bug 1982878

Summary: Coverity Issues Found
Product: Red Hat Enterprise Linux 8 Reporter: Andy Walsh <awalsh>
Component: vdoAssignee: sclafani
Status: CLOSED ERRATA QA Contact: Filip Suba <fsuba>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.5CC: awalsh, cwei, fsuba
Target Milestone: betaKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 6.2.5.65 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-09 19:28:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Andy Walsh 2021-07-15 21:38:55 UTC
Description of problem:
With the new build, two new coverity issues were discovered.

Error: CPPCHECK_WARNING (CWE-456):
vdo-e6ad32e1769484d59fc059163643a991da0799f9/utils/vdo/user/fileLayer.c:250: error[uninitvar]: Uninitialized variable: layer
#  248|     result = fileExists(layer->name, &exists);
#  249|     if (result != UDS_SUCCESS) {
#  250|->     FREE(layer);
#  251|       return result;
#  252|     }

Error: RESOURCE_LEAK (CWE-772):
vdo-e6ad32e1769484d59fc059163643a991da0799f9/utils/vdo/user/vdo2lvm.c:135: open_fn: Returning handle opened by "open". [Note: The source code implementation of the function has been overridden by a user model.]
vdo-e6ad32e1769484d59fc059163643a991da0799f9/utils/vdo/user/vdo2lvm.c:135: var_assign: Assigning: "fd" = handle returned from "open(fileName, 2178)".
vdo-e6ad32e1769484d59fc059163643a991da0799f9/utils/vdo/user/vdo2lvm.c:147: noescape: Resource "fd" is not freed or pointed-to in "fcntl".
vdo-e6ad32e1769484d59fc059163643a991da0799f9/utils/vdo/user/vdo2lvm.c:150: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
#  148|     if (result != VDO_SUCCESS) {
#  149|       warnx("Unable to clear non-blocking flag for %s", fileName);
#  150|->     return result;
#  151|     }
#  152|   

Per Scliff: neither coverity item is of consequence. The first is a false positive that's trivial to silence, and the second is a genuine file descriptor leak (also trivial to fix) in the lvm conversion tool, which will exit shortly after leaking the descriptor, rendering it moot.

Version-Release number of selected component (if applicable):
vdo-6.2.5.62-14.el8

Actual results:
Coverity Warnings

Expected results:
No Coverity Warnings

Comment 4 Filip Suba 2021-08-16 08:00:37 UTC
Verified with vdo-6.2.5.65-14.el8.

Comment 7 errata-xmlrpc 2021-11-09 19:28:45 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (kmod-kvdo bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:4359