base: fix warnings reported by LLVM analyzer

The warnings were false positives though.
This commit is contained in:
Norman Feske 2019-01-28 14:37:17 +01:00
parent 6b289a1423
commit bcb24e316c
5 changed files with 29 additions and 17 deletions

View File

@ -45,9 +45,18 @@ unsigned long long Platform_thread::execution_time() const
int Platform_thread::start(void *ip, void *sp)
{
if (!_platform_pd) {
/*
* This can never happen because each 'Platform_thread' is bound
* to its 'Platform_pd' at creation time, before 'start' can be
* called.
*/
ASSERT_NEVER_CALLED;
}
/* map the pager cap */
if (_platform_pd)
_pager.map(_platform_pd->native_task().data()->kcap());
_pager.map(_platform_pd->native_task().data()->kcap());
/* reserve utcb area and associate thread with this task */
l4_thread_control_start();

View File

@ -221,11 +221,12 @@ namespace {
{
*((int *)CMSG_DATA((cmsghdr *)_cmsg_buf) + _num_sds) = sd;
_num_sds++;
struct cmsghdr *cmsg = CMSG_FIRSTHDR(&_msg);
cmsg->cmsg_len = CMSG_LEN(_num_sds*sizeof(int));
_msg.msg_controllen = cmsg->cmsg_len; /* actual cmsg length */
if (cmsg) {
_num_sds++;
cmsg->cmsg_len = CMSG_LEN(_num_sds*sizeof(int));
_msg.msg_controllen = cmsg->cmsg_len; /* actual cmsg length */
}
}
void accept_sockets(int num_sds)

View File

@ -41,13 +41,13 @@ void Ram_dataspace_factory::_clear_ds (Dataspace_component &ds)
{
size_t const page_rounded_size = (ds.size() + get_page_size() - 1) & get_page_mask();
enum { ONE_PAGE = 1 };
/* allocate one page in core's virtual address space */
void *virt_addr_ptr = nullptr;
if (!platform().region_alloc().alloc(get_page_size(), &virt_addr_ptr) ||
!virt_addr_ptr)
ASSERT(!"could not map 4k inside core");
if (!platform().region_alloc().alloc(get_page_size(), &virt_addr_ptr))
ASSERT_NEVER_CALLED;
if (!virt_addr_ptr)
ASSERT_NEVER_CALLED;
addr_t const virt_addr = reinterpret_cast<addr_t const>(virt_addr_ptr);
@ -55,6 +55,7 @@ void Ram_dataspace_factory::_clear_ds (Dataspace_component &ds)
for (addr_t offset = 0; offset < page_rounded_size; offset += get_page_size())
{
addr_t const phys_addr = ds.phys_addr() + offset;
enum { ONE_PAGE = 1 };
/* map one physical page to the core-local address */
if (!map_local(phys_addr, virt_addr, ONE_PAGE)) {

View File

@ -154,15 +154,16 @@ class Genode::Capability_space_sel4
bool higher(Tree_managed_data *data)
{
return data->rpc_obj_key().value() > rpc_obj_key().value();
return data->rpc_obj_key().value() > this->rpc_obj_key().value();
}
Tree_managed_data *find_by_key(Rpc_obj_key key)
{
if (key.value() == rpc_obj_key().value()) return this;
if (key.value() == this->rpc_obj_key().value())
return this;
Tree_managed_data *data =
this->child(key.value() > rpc_obj_key().value());
this->child(key.value() > this->rpc_obj_key().value());
return data ? data->find_by_key(key) : nullptr;
}

View File

@ -97,15 +97,15 @@ class Genode::Capability_space_tpl
bool higher(Tree_managed_data *data)
{
return data->rpc_obj_key().value() > rpc_obj_key().value();
return data->rpc_obj_key().value() > this->rpc_obj_key().value();
}
Tree_managed_data *find_by_key(Rpc_obj_key key)
{
if (key.value() == rpc_obj_key().value()) return this;
if (key.value() == this->rpc_obj_key().value()) return this;
Tree_managed_data *data =
this->child(key.value() > rpc_obj_key().value());
this->child(key.value() > this->rpc_obj_key().value());
return data ? data->find_by_key(key) : nullptr;
}