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

Re: [libvirt] [PATCH 2/7] testutils: Resolve Coverity issues



On Thu, Jul 11, 2013 at 08:34:02AM -0400, John Ferlan wrote:
> Recent changes uncovered a NEGATIVE_RETURNS in the return from sysconf()
> when processing a for loop in virtTestCaptureProgramExecChild()
> ---
>  tests/testutils.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/tests/testutils.c b/tests/testutils.c
> index ec0fe52..2fdf7b8 100644
> --- a/tests/testutils.c
> +++ b/tests/testutils.c
> @@ -281,6 +281,9 @@ void virtTestCaptureProgramExecChild(const char *const argv[],
>          goto cleanup;
>  
>      open_max = sysconf(_SC_OPEN_MAX);
> +    if (open_max < 0)
> +        goto cleanup;
> +
>      for (i = 0; i < open_max; i++) {
>          if (i != stdinfd &&
>              i != pipefd) {

ACK, there are several more cases of sysconf(_SC_OPEN_MAX) in other
libvirt code which are not checked too, but happen to not trigger
coverity. We ought to fix those too.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


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