RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1219214 - Coverity-detected defect: call to fcntl without checking return value
Summary: Coverity-detected defect: call to fcntl without checking return value
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm
Version: 6.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Jeff Cody
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 1219217
TreeView+ depends on / blocked
 
Reported: 2015-05-06 20:29 UTC by Jeff Nelson
Modified: 2016-01-26 09:13 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1219217 (view as bug list)
Environment:
Last Closed: 2016-01-20 19:47:33 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jeff Nelson 2015-05-06 20:29:30 UTC
Description of problem:
Coverity reports:

CHECKED_RETURN (block/gluster.c:335)
Calling "fcntl(s->fds[0], 4, 2048)" without checking return value. This library function may fail and return an error code. 

Error occurs in function qemu_gluster_open.

Version-Release number of selected component (if applicable):
qemu-kvm-0.12.1.2-2.474.el6

Additional info:
Appears to be legitimate defect. Present in rhel7 too, but has been around for years.

Comment 2 Paolo Bonzini 2016-01-20 19:47:33 UTC
No, it is not valid. We know that nothing can fail here. IIRC without having the code in front of me this is a F_SETFL.

Comment 3 Jeff Nelson 2016-01-21 01:25:28 UTC
>IIRC without having the code in front of me this is a F_SETFL.

It is.

>We know that nothing can fail here.

fcntl is documented as returning specific error conditions when a given operation is attempted; the F_SETFL command is not specifically mentioned, so these error conditions cannot occur. However, several generic error conditions are documented--without mentioning a command--so it is reasonable to assume they could occur:

 EACCES or EAGAIN
   Operation is prohibited by locks held by other processes.

 EAGAIN
   The operation is prohibited because the file has been memory-mapped by another process.

 EBADF
   fd is not an open file descriptor

 ENOLCK
   Too many segment locks open, lock table is full, or a remote locking protocol failed (e.g., locking over NFS).

 EPERM
   Attempted to clear the O_APPEND flag on a file that has the append-only attribute set.

Out of all these, I'd be most concerned about ENOLCK (given that this is in a glusterfs function). Are you sure that nothing can fail here?

Comment 4 Paolo Bonzini 2016-01-21 08:49:24 UTC
The file descriptor is a pipe that has been just opened, so it cannot be any of the above.


Note You need to log in before you can comment on or make changes to this bug.