Re: [PATCH 3/4] utils: Remove ATTRIBUTE_NONNULL(1) from virCommandSetSendBuffer

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

 




On 7/26/19 9:42 AM, Stefan Berger wrote:
> Remove the ATTRIBUTE_NONNULL(1) from virCommandSetSendBuffer()
> prototype since we are checking for '!cmd'.
> 
> Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxxxxx>
> ---
>  src/util/vircommand.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Coverity will complain that virCommandSetSendBuffer has:

    size_t i = virCommandGetNumSendBuffers(cmd);

    if (!cmd || cmd->has_error)
        return -1;

Since @cmd is dereffed in virCommandGetNumSendBuffers

Just move the initialization to after the return -1; and things will be
good.

John

> diff --git a/src/util/vircommand.h b/src/util/vircommand.h
> index c2abc7b2c3..74574e3fb1 100644
> --- a/src/util/vircommand.h
> +++ b/src/util/vircommand.h
> @@ -149,7 +149,7 @@ void virCommandSetWorkingDirectory(virCommandPtr cmd,
>  int virCommandSetSendBuffer(virCommandPtr cmd,
>                              int fd,
>                              unsigned char *buffer, size_t buflen)
> -    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
> +    ATTRIBUTE_NONNULL(3);
>  
>  void virCommandSetInputBuffer(virCommandPtr cmd,
>                                const char *inbuf) ATTRIBUTE_NONNULL(2);
> 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux