[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 09/10] build: silence coverity false positive



On Thu, Jun 02, 2011 at 05:08:01PM -0600, Eric Blake wrote:
> Coverity complained that infd could be -1 at the point where it is
> passed to write, when in reality, this code can only be reached if
> infd is non-negative.
> 
> * src/util/command.c (virCommandProcessIO): Help out coverity.
> ---
>  src/util/command.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/src/util/command.c b/src/util/command.c
> index a2f7ff6..b51bdcf 100644
> --- a/src/util/command.c
> +++ b/src/util/command.c
> @@ -961,6 +961,9 @@ virCommandProcessIO(virCommandPtr cmd)
>              } else {
>                  int done;
> 
> +                /* Coverity 5.3.0 can't see that we only get here if
> +                 * infd is in the set because it was non-negative.  */
> +                sa_assert(infd != -1);
>                  done = write(infd, cmd->inbuf + inoff,
>                               inlen - inoff);
>                  if (done < 0) {

  ACK,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]