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:
Peter Krempa 2021-05-19 16:58:29 +02:00
parent bbd55e9284
commit 92a3eddd03
13 changed files with 0 additions and 37 deletions

View File

@ -980,7 +980,6 @@ virDomainObjListCollect(virDomainObjList *domlist,
struct virDomainListData data = { NULL, 0 };
virObjectRWLockRead(domlist);
sa_assert(domlist->objs);
data.vms = g_new0(virDomainObj *, virHashSize(domlist->objs));
virHashForEach(domlist->objs, virDomainObjListCollectIterator, &data);
@ -1040,7 +1039,6 @@ virDomainObjListConvert(virDomainObjList *domlist,
}
virObjectRWUnlock(domlist);
sa_assert(*vms);
virDomainObjListFilter(vms, nvms, conn, filter, flags);
return 0;

View File

@ -432,7 +432,6 @@ virNWFilterBindingObjListCollect(virNWFilterBindingObjList *domlist,
struct virNWFilterBindingListData data = { NULL, 0 };
virObjectRWLockRead(domlist);
sa_assert(domlist->objs);
data.bindings = g_new0(virNWFilterBindingObj *, virHashSize(domlist->objs));
virHashForEach(domlist->objs, virNWFilterBindingObjListCollectIterator, &data);

View File

@ -1666,8 +1666,6 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
}
if (flags & VIR_DOMAIN_MEM_CONFIG) {
/* Help clang 2.8 decipher the logic flow. */
sa_assert(persistentDef);
virDomainDefSetMemoryTotal(persistentDef, newmem);
if (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) {
sa_assert(persistentDef);
persistentDef->mem.cur_balloon = newmem;
ret = virDomainDefSave(persistentDef, driver->xmlopt, cfg->configDir);
goto endjob;
@ -2476,9 +2473,6 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu,
if (flags & VIR_DOMAIN_AFFECT_LIVE)
targetDef = vm->def;
/* Make sure coverity knows targetDef is valid at this point. */
sa_assert(targetDef);
pcpumap = virBitmapNewData(cpumap, maplen);
if (!pcpumap)
goto endjob;
@ -2557,9 +2551,6 @@ libxlDomainGetVcpuPinInfo(virDomainPtr dom, int ncpumaps,
if (flags & VIR_DOMAIN_AFFECT_LIVE)
targetDef = vm->def;
/* Make sure coverity knows targetDef is valid at this point. */
sa_assert(targetDef);
hostcpus = virBitmapNew(libxl_get_max_cpus(cfg->ctx));
virBitmapSetAll(hostcpus);

View File

@ -398,9 +398,6 @@ qemuMonitorIOWriteWithFD(qemuMonitor *mon,
msg.msg_controllen = sizeof(control);
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_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS;

View File

@ -2089,7 +2089,6 @@ qemuProcessReadLog(qemuDomainLogContext *logCtxt,
*eol = '\n';
}
}
filter_next = NULL; /* silence false coverity warning */
if (got > 0 &&
buf[got - 1] == '\n') {

View File

@ -937,10 +937,6 @@ virNetServerProcessClients(virNetServer *srv)
reprocess:
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];
virObjectLock(client);
if (virNetServerClientWantCloseLocked(client))

View File

@ -2263,9 +2263,6 @@ virCommandProcessIO(virCommand *cmd)
buf = cmd->errbuf;
len = &errlen;
}
/* Silence a false positive from clang. */
sa_assert(buf);
done = read(fds[i].fd, data, sizeof(data));
if (done < 0) {
if (errno != EINTR &&

View File

@ -472,12 +472,6 @@ virConfParseValue(virConfParserCtxt *ctxt)
}
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 != ',') {
virConfError(ctxt, VIR_ERR_CONF_SYNTAX,
_("expecting a separator in list"));

View File

@ -313,7 +313,6 @@ virHostMemSetParameterValue(virTypedParameterPtr param)
int rc = -1;
char *field = strchr(param->field, '_');
sa_assert(field);
field++;
path = g_strdup_printf("%s/%s", SYSFS_MEMORY_SHARED_PATH, field);
@ -338,7 +337,6 @@ virHostMemParametersAreAllSupported(virTypedParameterPtr params,
virTypedParameterPtr param = &params[i];
char *field = strchr(param->field, '_');
sa_assert(field);
field++;
path = g_strdup_printf("%s/%s", SYSFS_MEMORY_SHARED_PATH, field);

View File

@ -182,7 +182,6 @@ virClassNew(virClass *parent,
return NULL;
} else if (objectSize <= parentSize ||
parentSize != (parent ? parent->objectSize : 0)) {
sa_assert(parent);
virReportInvalidArg(objectSize,
_("object size %zu of %s is not larger than parent class %zu"),
objectSize, name, parent->objectSize);

View File

@ -512,9 +512,6 @@ virGetHostnameImpl(bool quiet)
return g_strdup(hostname);
}
/* Tell static analyzers about getaddrinfo semantics. */
sa_assert(info);
if (info->ai_canonname == NULL ||
STRPREFIX(info->ai_canonname, "localhost"))
/* in this case, we tried to canonicalize and we ended up back with

View File

@ -611,7 +611,6 @@ static int test17(const void *unused G_GNUC_UNUSED)
goto cleanup;
}
sa_assert(outbuf);
if (*outbuf) {
puts("output buffer is not an allocated empty string");
goto cleanup;

View File

@ -449,7 +449,6 @@ vshCmddefGetOption(vshControl *ctl, const vshCmdDef *cmd, const char *name,
opt->help = "string": straight replacement of name
opt->help = "string=value": treat boolean flag as
alias of option and its default value */
sa_assert(!alias);
alias = g_strdup(opt->help);
name = alias;
if ((value = strchr(name, '='))) {