From: Ian Campbell Subject: Re: Coverity issues with block stubdom support in libxl Date: Wed, 20 Nov 2013 14:02:30 +0000 Message-ID: <1384956150.6071.31.camel@kazak.uk.xensource.com> References: <528CBDDE.6090200@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <528CBDDE.6090200@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: Xen-devel List , Roger Pau Monne List-Id: xen-devel@lists.xenproject.org On Wed, 2013-11-20 at 13:49 +0000, Andrew Cooper wrote: > CID 1130516 - NEGATIVE_RETURNS > xl_cmdimpl.c: do_daemonize(). Coverity complains that it is possible to > dup2(logfile, 1); with logfile as -1. It appears that the uses of > CHK_ERRNO() are bogus. CHK_ERRNO() itself tests for "(call) < 0". In > do_daemonize(), the tests therefore become "if ( ((call) < 0) < 0 )" > which fails to catch the error condition. I suspect removing the > trailing "<0" in the CHK_ERRNO() calls should fix the error (but I would > appreciate a second opinion on this). Yes, I think that macro is a bit dodgy -- it's called in two different contexts and handles neither of them properly AFAICT! See http://marc.info/?l=xen-devel&m=138018557503300 for previous discussion.