[libvirt] [PATCH] domain_addr: Resolve Coverity warning
Peter Krempa
pkrempa at redhat.com
Mon Jun 23 06:42:12 UTC 2014
On 06/21/14 13:54, John Ferlan wrote:
> Recent changes in the module :
>
> http://www.redhat.com/archives/libvir-list/2014-June/msg00978.html
>
> seem to have caused Coverity to "take a look"...
>
> The virDomainCCWAddressAsString() API returns either a NULL or a string
> and the comparison of the returned value to "< 0" caused following errors:
>
> [1] CONSTANT_EXPRESSION_RESULT
> (1) Event result_independent_of_operands:
> "!(addr = virDomainCCWAddressAsString(&addrs->next)) < 0" is always
> false regardless of the values of its operands. This occurs as the
> logical operand of if.
>
> and
>
> 2] DEADCODE
> (1) Event between:
> At condition "!(addr = virDomainCCWAddressAsString(&addrs->next)) < 0",
> the value of "addr = virDomainCCWAddressAsString(&addrs->next)" must
> be between 0 and 1.
>
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
> src/conf/domain_addr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Although your version was first I like Jan's better as it's fixing two
issues of botched error checking of the function in question.
Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140623/50627e2b/attachment-0001.sig>
More information about the libvir-list
mailing list