From 398ce48d5c6e728b8471df8c9dfa8e7429783620 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Fri, 5 Aug 2011 09:10:18 -0600 Subject: [PATCH] qemu: silence clang false positive Our logic throws off analyzer tools: ptr var = NULL; if (flags == 0) flags = live ? _LIVE : _CONFIG; if (flags & _LIVE) do stuff if (flags & _CONFIG) var = non-null; if (flags & _LIVE) do more stuff else if (flags & _CONFIG) use var the tools keep thinking that var can still be NULL in the last if clause, adding the hint shuts them up. * src/qemu/qemu_driver.c (qemuDomainSetBlkioParameters): Add a static analysis hint. --- src/qemu/qemu_driver.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 19e749f1eb..421a98ecd7 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5688,6 +5688,9 @@ static int qemuDomainSetBlkioParameters(virDomainPtr dom, } } } else if (flags & VIR_DOMAIN_AFFECT_CONFIG) { + /* Clang can't see that if we get here, persistentDef was set. */ + sa_assert(persistentDef); + for (i = 0; i < nparams; i++) { virTypedParameterPtr param = ¶ms[i];