From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Cc: xen-devel@lists.xen.org, Matthew Daley <mattjd@gmail.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Ian Campbell <ian.campbell@citrix.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: Re: [PATCH 25/29] libvchan: check for fcntl failures in select-type sample application
Date: Wed, 30 Oct 2013 17:13:38 +0000 [thread overview]
Message-ID: <52713E42.7060607@citrix.com> (raw)
In-Reply-To: <52713C94.1050001@tycho.nsa.gov>
On 30/10/13 17:06, Daniel De Graaf wrote:
> On 10/30/2013 03:52 AM, Matthew Daley wrote:
>> Coverity-ID: 1055041
>> Signed-off-by: Matthew Daley <mattjd@gmail.com>
>> ---
>> tools/libvchan/node-select.c | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/libvchan/node-select.c b/tools/libvchan/node-select.c
>> index 6c6c19e..c6914ab 100644
>> --- a/tools/libvchan/node-select.c
>> +++ b/tools/libvchan/node-select.c
>> @@ -105,8 +105,10 @@ int main(int argc, char **argv)
>> exit(1);
>> }
>>
>> - fcntl(0, F_SETFL, O_NONBLOCK);
>> - fcntl(1, F_SETFL, O_NONBLOCK);
>> + if (fcntl(0, F_SETFL, O_NONBLOCK) == -1 || fcntl(1, F_SETFL,
>> O_NONBLOCK) == -1) {
>> + perror("fcntl");
>> + exit(1);
>> + }
>>
>> libxenvchan_fd = libxenvchan_fd_for_select(ctrl);
>> for (;;) {
>>
>
> To be completely correct, a call to F_GETFL would be required first, with
> the result ORed with O_NONBLOCK and passed to F_SETFL. That is a separate
> existing bug in the code, however, so this patch is still an improvement
> as-is.
>
> Is the fcntl on line 156 different in some way that does not trigger this
> Coverity check?
>
Hmm - that error wasn't flagged in the slightest by Coverity. I would
agree that it suffers from the same problem and needs
appropriately-similar fixing.
It is possible Coverity only flagged the first instance of all ignored
return values from fcntl(1,...) library calls. Some of the checkers
seem to have logic which decides that something consistently
wrong/questionable might be by design. I suspect that if the above were
fixed, then the latter would identified in the next scan.
~Andrew
next prev parent reply other threads:[~2013-10-30 17:13 UTC|newest]
Thread overview: 84+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-30 7:51 Fixes for various minor Coverity issues, volume 3 Matthew Daley
2013-10-30 7:51 ` [PATCH 01/29] libxc: check for xc_domain_get_guest_width failure and pass it down Matthew Daley
2013-10-31 21:03 ` Ian Campbell
2013-11-01 0:24 ` [PATCH v2] " Matthew Daley
2013-11-01 13:12 ` Ian Campbell
2013-11-02 22:57 ` [PATCH v3] libxc: check for various libxc failures and pass them down Matthew Daley
2013-11-02 23:08 ` [PATCH v4] " Matthew Daley
2013-11-04 17:31 ` Ian Campbell
2013-11-05 4:58 ` Matthew Daley
2013-11-05 10:10 ` Ian Campbell
2013-10-30 7:51 ` [PATCH 02/29] libxc: fix retrieval of and remove pointless check on gzip size Matthew Daley
2013-10-30 10:50 ` Andrew Cooper
2013-10-30 22:08 ` Matthew Daley
2013-10-31 2:58 ` [PATCH v2] " Matthew Daley
2013-10-31 10:22 ` Andrew Cooper
2013-10-31 22:07 ` Ian Campbell
2013-10-30 7:51 ` [PATCH 03/29] libxc: fix memory leak in move_l3_below_4G error handling Matthew Daley
2013-10-30 7:51 ` [PATCH 04/29] libxc: don't ignore fd read failures when restoring a domain Matthew Daley
2013-10-30 7:51 ` [PATCH 05/29] libxc: tidy up loop construct in write_compressed Matthew Daley
2013-10-30 7:51 ` [PATCH 06/29] libxc: don't read uninitialized size value in xc_read_image Matthew Daley
2013-10-31 21:22 ` Ian Campbell
2013-10-31 22:12 ` Matthew Daley
2013-10-31 22:26 ` Ian Campbell
2013-10-30 7:51 ` [PATCH 07/29] libxc: remove pointless null pointer check in xc_interface_open_common Matthew Daley
2013-10-30 7:51 ` [PATCH 08/29] libxc: check for xc_domain_get_guest_width failure in xc_domain_resume_any Matthew Daley
2013-10-30 7:51 ` [PATCH 09/29] libxc: check for xc_vcpu_setcontext " Matthew Daley
2013-10-31 21:56 ` Ian Campbell
2013-11-01 0:27 ` [PATCH v2] " Matthew Daley
2013-11-01 13:26 ` Ian Campbell
2013-11-01 16:34 ` [PATCH 09/29] " Ian Jackson
2013-11-04 10:29 ` Ian Campbell
2013-10-30 7:51 ` [PATCH 10/29] libxc: initalize stdio loggers' progress_last_percent values to 0 Matthew Daley
2013-10-30 7:51 ` [PATCH 11/29] libxc: remove null pointer checks in xc_pm_get_{c, p}xstat Matthew Daley
2013-10-30 7:51 ` [PATCH 12/29] libxl: check for transaction abortion failure in libxl_set_memory_target Matthew Daley
2013-10-30 7:51 ` [PATCH 13/29] libxl: check for xc_domain_max_vcpus failure in libxl__build_pre Matthew Daley
2013-10-31 21:29 ` Ian Campbell
2013-11-01 0:29 ` [PATCH v2] " Matthew Daley
2013-11-01 13:27 ` Ian Campbell
2013-10-30 7:51 ` [PATCH 14/29] libxl: don't leak xs_read results in libxl__device_nic_from_xs_be Matthew Daley
2013-10-30 8:58 ` Roger Pau Monné
2013-10-30 9:51 ` Matthew Daley
2013-10-31 21:31 ` Ian Campbell
2013-10-30 7:51 ` [PATCH 15/29] libxl: correct file open success check in libxl__device_pci_reset Matthew Daley
2013-10-30 7:51 ` [PATCH 16/29] libxl: check for xc_domain_shutdown failure in libxl__domain_suspend_common_callback Matthew Daley
2013-10-31 21:36 ` Ian Campbell
2013-11-01 0:30 ` [PATCH v2] " Matthew Daley
2013-11-01 13:27 ` Ian Campbell
2013-10-30 7:51 ` [PATCH 17/29] libxl: don't leak memory in libxl__poller_get failure case Matthew Daley
2013-10-30 7:51 ` [PATCH 18/29] libxl: only close fds which successfully opened in libxl__spawn_local_dm Matthew Daley
2013-10-30 7:51 ` [PATCH 19/29] xl: libxl_list_vm returns a pointer, not a handle Matthew Daley
2013-10-30 7:51 ` [PATCH 20/29] xl: check for restore file open failure in create_domain Matthew Daley
2013-10-30 7:51 ` [PATCH 21/29] xl: remove needless infinite-loop construct " Matthew Daley
2013-10-30 7:51 ` [PATCH 22/29] xl: correct references to long-removed function in error messages Matthew Daley
2013-10-30 7:51 ` [PATCH 23/29] docs: make `xl vcpu-list` example use verbatim formatting Matthew Daley
2013-10-30 10:53 ` Matthew Daley
2013-10-31 3:02 ` [PATCH v2] docs: make `xl vm-list` " Matthew Daley
2013-10-30 7:52 ` [PATCH 24/29] libvchan: handle libxc evtchn failures properly in init functions Matthew Daley
2013-10-30 10:12 ` Matthew Daley
2013-10-30 14:52 ` Daniel De Graaf
2013-10-30 22:07 ` Matthew Daley
2013-10-30 22:17 ` Matthew Daley
2013-10-31 3:41 ` [PATCH v2] " Matthew Daley
2013-10-30 7:52 ` [PATCH 25/29] libvchan: check for fcntl failures in select-type sample application Matthew Daley
2013-10-30 17:06 ` Daniel De Graaf
2013-10-30 17:13 ` Andrew Cooper [this message]
2013-10-30 22:04 ` Matthew Daley
2013-10-31 3:44 ` [PATCH v2] libvchan: tidy up usages of fcntl " Matthew Daley
2013-10-31 21:47 ` Ian Campbell
2013-11-01 0:33 ` [PATCH v3] " Matthew Daley
2013-11-01 13:28 ` Ian Campbell
2013-11-01 14:11 ` Daniel De Graaf
2013-11-04 17:51 ` Ian Campbell
2013-10-30 7:52 ` [PATCH 26/29] xenctx: only alloc symbol if we are inserting it into the symbol table Matthew Daley
2013-10-30 8:59 ` Jan Beulich
2013-10-30 7:52 ` [PATCH 27/29] xenctx: correct error check when opening libxc Matthew Daley
2013-10-30 12:48 ` George Dunlap
2013-10-30 7:52 ` [PATCH 28/29] xentrace: don't try to close null libxc handle in disable_tbufs Matthew Daley
2013-10-30 12:47 ` George Dunlap
2013-10-30 7:52 ` [PATCH 29/29] xentrace: undeadify invalid option argument handling Matthew Daley
2013-10-30 12:47 ` George Dunlap
2013-10-31 12:28 ` Fixes for various minor Coverity issues, volume 3 Andrew Cooper
2013-10-31 21:55 ` Matthew Daley
2013-10-31 22:10 ` Ian Campbell
2013-11-01 2:08 ` Matthew Daley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52713E42.7060607@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=dgdegra@tycho.nsa.gov \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=mattjd@gmail.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).