[libvirt] [PATCH] conf: Remove unnecessary @ctxt check in virSecurityLabelDefsParseXML

Ján Tomko jtomko at redhat.com
Thu Mar 7 16:40:55 UTC 2019


s/@ctxt check/checks/

On Thu, Mar 07, 2019 at 11:25:18AM -0500, John Ferlan wrote:
>Failure would have occurred before in callers other virXPath calls.
>
>Found by Coverity due to commit 66a508d2 using VIR_XPATH_NODE_AUTORESTORE
>to access @ctxt before the if condition.
>
>Signed-off-by: John Ferlan <jferlan at redhat.com>
>---
> src/conf/domain_conf.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
>diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>index eb660f5764..dc57b23084 100644
>--- a/src/conf/domain_conf.c
>+++ b/src/conf/domain_conf.c
>@@ -8516,8 +8516,7 @@ virSecurityLabelDefsParseXML(virDomainDefPtr def,
>     virCapsHostPtr host = &caps->host;
>     VIR_AUTOFREE(xmlNodePtr *) list = NULL;
>
>-    /* Check args and save context */
>-    if (def == NULL || ctxt == NULL)
>+    if (def == NULL)
>         return 0;
>

Both now and at the point of its introduction in:
commit e9377dda367b847b5a15dac1403bcdf19f05438a
    Multiple security drivers in XML data

def is dereferenced right before its only caller
so you can delete the whole condition.

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190307/fc41add3/attachment-0001.sig>


More information about the libvir-list mailing list