mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-05 13:17:51 +03:00
Remove static analysis assertions
None of them are currently needed to pass our upstream CI, most were either for ancient clang versions or coverity for silencing false positives. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
bbd55e9284
commit
92a3eddd03
@ -980,7 +980,6 @@ virDomainObjListCollect(virDomainObjList *domlist,
|
|||||||
struct virDomainListData data = { NULL, 0 };
|
struct virDomainListData data = { NULL, 0 };
|
||||||
|
|
||||||
virObjectRWLockRead(domlist);
|
virObjectRWLockRead(domlist);
|
||||||
sa_assert(domlist->objs);
|
|
||||||
data.vms = g_new0(virDomainObj *, virHashSize(domlist->objs));
|
data.vms = g_new0(virDomainObj *, virHashSize(domlist->objs));
|
||||||
|
|
||||||
virHashForEach(domlist->objs, virDomainObjListCollectIterator, &data);
|
virHashForEach(domlist->objs, virDomainObjListCollectIterator, &data);
|
||||||
@ -1040,7 +1039,6 @@ virDomainObjListConvert(virDomainObjList *domlist,
|
|||||||
}
|
}
|
||||||
virObjectRWUnlock(domlist);
|
virObjectRWUnlock(domlist);
|
||||||
|
|
||||||
sa_assert(*vms);
|
|
||||||
virDomainObjListFilter(vms, nvms, conn, filter, flags);
|
virDomainObjListFilter(vms, nvms, conn, filter, flags);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -432,7 +432,6 @@ virNWFilterBindingObjListCollect(virNWFilterBindingObjList *domlist,
|
|||||||
struct virNWFilterBindingListData data = { NULL, 0 };
|
struct virNWFilterBindingListData data = { NULL, 0 };
|
||||||
|
|
||||||
virObjectRWLockRead(domlist);
|
virObjectRWLockRead(domlist);
|
||||||
sa_assert(domlist->objs);
|
|
||||||
data.bindings = g_new0(virNWFilterBindingObj *, virHashSize(domlist->objs));
|
data.bindings = g_new0(virNWFilterBindingObj *, virHashSize(domlist->objs));
|
||||||
|
|
||||||
virHashForEach(domlist->objs, virNWFilterBindingObjListCollectIterator, &data);
|
virHashForEach(domlist->objs, virNWFilterBindingObjListCollectIterator, &data);
|
||||||
|
@ -1666,8 +1666,6 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flags & VIR_DOMAIN_MEM_CONFIG) {
|
if (flags & VIR_DOMAIN_MEM_CONFIG) {
|
||||||
/* Help clang 2.8 decipher the logic flow. */
|
|
||||||
sa_assert(persistentDef);
|
|
||||||
virDomainDefSetMemoryTotal(persistentDef, newmem);
|
virDomainDefSetMemoryTotal(persistentDef, newmem);
|
||||||
if (persistentDef->mem.cur_balloon > newmem)
|
if (persistentDef->mem.cur_balloon > newmem)
|
||||||
persistentDef->mem.cur_balloon = newmem;
|
persistentDef->mem.cur_balloon = newmem;
|
||||||
@ -1702,7 +1700,6 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flags & VIR_DOMAIN_MEM_CONFIG) {
|
if (flags & VIR_DOMAIN_MEM_CONFIG) {
|
||||||
sa_assert(persistentDef);
|
|
||||||
persistentDef->mem.cur_balloon = newmem;
|
persistentDef->mem.cur_balloon = newmem;
|
||||||
ret = virDomainDefSave(persistentDef, driver->xmlopt, cfg->configDir);
|
ret = virDomainDefSave(persistentDef, driver->xmlopt, cfg->configDir);
|
||||||
goto endjob;
|
goto endjob;
|
||||||
@ -2476,9 +2473,6 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu,
|
|||||||
if (flags & VIR_DOMAIN_AFFECT_LIVE)
|
if (flags & VIR_DOMAIN_AFFECT_LIVE)
|
||||||
targetDef = vm->def;
|
targetDef = vm->def;
|
||||||
|
|
||||||
/* Make sure coverity knows targetDef is valid at this point. */
|
|
||||||
sa_assert(targetDef);
|
|
||||||
|
|
||||||
pcpumap = virBitmapNewData(cpumap, maplen);
|
pcpumap = virBitmapNewData(cpumap, maplen);
|
||||||
if (!pcpumap)
|
if (!pcpumap)
|
||||||
goto endjob;
|
goto endjob;
|
||||||
@ -2557,9 +2551,6 @@ libxlDomainGetVcpuPinInfo(virDomainPtr dom, int ncpumaps,
|
|||||||
if (flags & VIR_DOMAIN_AFFECT_LIVE)
|
if (flags & VIR_DOMAIN_AFFECT_LIVE)
|
||||||
targetDef = vm->def;
|
targetDef = vm->def;
|
||||||
|
|
||||||
/* Make sure coverity knows targetDef is valid at this point. */
|
|
||||||
sa_assert(targetDef);
|
|
||||||
|
|
||||||
hostcpus = virBitmapNew(libxl_get_max_cpus(cfg->ctx));
|
hostcpus = virBitmapNew(libxl_get_max_cpus(cfg->ctx));
|
||||||
virBitmapSetAll(hostcpus);
|
virBitmapSetAll(hostcpus);
|
||||||
|
|
||||||
|
@ -398,9 +398,6 @@ qemuMonitorIOWriteWithFD(qemuMonitor *mon,
|
|||||||
msg.msg_controllen = sizeof(control);
|
msg.msg_controllen = sizeof(control);
|
||||||
|
|
||||||
cmsg = CMSG_FIRSTHDR(&msg);
|
cmsg = CMSG_FIRSTHDR(&msg);
|
||||||
/* Some static analyzers, like clang 2.6-0.6.pre2, fail to see
|
|
||||||
that our use of CMSG_FIRSTHDR will not return NULL. */
|
|
||||||
sa_assert(cmsg);
|
|
||||||
cmsg->cmsg_len = CMSG_LEN(sizeof(int));
|
cmsg->cmsg_len = CMSG_LEN(sizeof(int));
|
||||||
cmsg->cmsg_level = SOL_SOCKET;
|
cmsg->cmsg_level = SOL_SOCKET;
|
||||||
cmsg->cmsg_type = SCM_RIGHTS;
|
cmsg->cmsg_type = SCM_RIGHTS;
|
||||||
|
@ -2089,7 +2089,6 @@ qemuProcessReadLog(qemuDomainLogContext *logCtxt,
|
|||||||
*eol = '\n';
|
*eol = '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
filter_next = NULL; /* silence false coverity warning */
|
|
||||||
|
|
||||||
if (got > 0 &&
|
if (got > 0 &&
|
||||||
buf[got - 1] == '\n') {
|
buf[got - 1] == '\n') {
|
||||||
|
@ -937,10 +937,6 @@ virNetServerProcessClients(virNetServer *srv)
|
|||||||
|
|
||||||
reprocess:
|
reprocess:
|
||||||
for (i = 0; i < srv->nclients; i++) {
|
for (i = 0; i < srv->nclients; i++) {
|
||||||
/* Coverity 5.3.0 couldn't see that srv->clients is non-NULL
|
|
||||||
* if srv->nclients is non-zero. */
|
|
||||||
sa_assert(srv->clients);
|
|
||||||
|
|
||||||
client = srv->clients[i];
|
client = srv->clients[i];
|
||||||
virObjectLock(client);
|
virObjectLock(client);
|
||||||
if (virNetServerClientWantCloseLocked(client))
|
if (virNetServerClientWantCloseLocked(client))
|
||||||
|
@ -2263,9 +2263,6 @@ virCommandProcessIO(virCommand *cmd)
|
|||||||
buf = cmd->errbuf;
|
buf = cmd->errbuf;
|
||||||
len = &errlen;
|
len = &errlen;
|
||||||
}
|
}
|
||||||
/* Silence a false positive from clang. */
|
|
||||||
sa_assert(buf);
|
|
||||||
|
|
||||||
done = read(fds[i].fd, data, sizeof(data));
|
done = read(fds[i].fd, data, sizeof(data));
|
||||||
if (done < 0) {
|
if (done < 0) {
|
||||||
if (errno != EINTR &&
|
if (errno != EINTR &&
|
||||||
|
@ -472,12 +472,6 @@ virConfParseValue(virConfParserCtxt *ctxt)
|
|||||||
}
|
}
|
||||||
while ((ctxt->cur < ctxt->end) && (CUR != ']')) {
|
while ((ctxt->cur < ctxt->end) && (CUR != ']')) {
|
||||||
|
|
||||||
/* Tell Clang that when execution reaches this point
|
|
||||||
"lst" is guaranteed to be non-NULL. This stops it
|
|
||||||
from issuing an invalid NULL-dereference warning about
|
|
||||||
"prev = lst; while (prev->next..." below. */
|
|
||||||
sa_assert(lst);
|
|
||||||
|
|
||||||
if (CUR != ',') {
|
if (CUR != ',') {
|
||||||
virConfError(ctxt, VIR_ERR_CONF_SYNTAX,
|
virConfError(ctxt, VIR_ERR_CONF_SYNTAX,
|
||||||
_("expecting a separator in list"));
|
_("expecting a separator in list"));
|
||||||
|
@ -313,7 +313,6 @@ virHostMemSetParameterValue(virTypedParameterPtr param)
|
|||||||
int rc = -1;
|
int rc = -1;
|
||||||
|
|
||||||
char *field = strchr(param->field, '_');
|
char *field = strchr(param->field, '_');
|
||||||
sa_assert(field);
|
|
||||||
field++;
|
field++;
|
||||||
path = g_strdup_printf("%s/%s", SYSFS_MEMORY_SHARED_PATH, field);
|
path = g_strdup_printf("%s/%s", SYSFS_MEMORY_SHARED_PATH, field);
|
||||||
|
|
||||||
@ -338,7 +337,6 @@ virHostMemParametersAreAllSupported(virTypedParameterPtr params,
|
|||||||
virTypedParameterPtr param = ¶ms[i];
|
virTypedParameterPtr param = ¶ms[i];
|
||||||
|
|
||||||
char *field = strchr(param->field, '_');
|
char *field = strchr(param->field, '_');
|
||||||
sa_assert(field);
|
|
||||||
field++;
|
field++;
|
||||||
path = g_strdup_printf("%s/%s", SYSFS_MEMORY_SHARED_PATH, field);
|
path = g_strdup_printf("%s/%s", SYSFS_MEMORY_SHARED_PATH, field);
|
||||||
|
|
||||||
|
@ -182,7 +182,6 @@ virClassNew(virClass *parent,
|
|||||||
return NULL;
|
return NULL;
|
||||||
} else if (objectSize <= parentSize ||
|
} else if (objectSize <= parentSize ||
|
||||||
parentSize != (parent ? parent->objectSize : 0)) {
|
parentSize != (parent ? parent->objectSize : 0)) {
|
||||||
sa_assert(parent);
|
|
||||||
virReportInvalidArg(objectSize,
|
virReportInvalidArg(objectSize,
|
||||||
_("object size %zu of %s is not larger than parent class %zu"),
|
_("object size %zu of %s is not larger than parent class %zu"),
|
||||||
objectSize, name, parent->objectSize);
|
objectSize, name, parent->objectSize);
|
||||||
|
@ -512,9 +512,6 @@ virGetHostnameImpl(bool quiet)
|
|||||||
return g_strdup(hostname);
|
return g_strdup(hostname);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tell static analyzers about getaddrinfo semantics. */
|
|
||||||
sa_assert(info);
|
|
||||||
|
|
||||||
if (info->ai_canonname == NULL ||
|
if (info->ai_canonname == NULL ||
|
||||||
STRPREFIX(info->ai_canonname, "localhost"))
|
STRPREFIX(info->ai_canonname, "localhost"))
|
||||||
/* in this case, we tried to canonicalize and we ended up back with
|
/* in this case, we tried to canonicalize and we ended up back with
|
||||||
|
@ -611,7 +611,6 @@ static int test17(const void *unused G_GNUC_UNUSED)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
sa_assert(outbuf);
|
|
||||||
if (*outbuf) {
|
if (*outbuf) {
|
||||||
puts("output buffer is not an allocated empty string");
|
puts("output buffer is not an allocated empty string");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -449,7 +449,6 @@ vshCmddefGetOption(vshControl *ctl, const vshCmdDef *cmd, const char *name,
|
|||||||
opt->help = "string": straight replacement of name
|
opt->help = "string": straight replacement of name
|
||||||
opt->help = "string=value": treat boolean flag as
|
opt->help = "string=value": treat boolean flag as
|
||||||
alias of option and its default value */
|
alias of option and its default value */
|
||||||
sa_assert(!alias);
|
|
||||||
alias = g_strdup(opt->help);
|
alias = g_strdup(opt->help);
|
||||||
name = alias;
|
name = alias;
|
||||||
if ((value = strchr(name, '='))) {
|
if ((value = strchr(name, '='))) {
|
||||||
|
Loading…
Reference in New Issue
Block a user