kernel: fix some bad casts in userspace.c

64-bit systems generate some compiler warnings about
data type sizes, use uintptr_t where int/u32_t was being cast
to void *.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2019-11-18 10:20:16 -08:00 committed by Andrew Boie
commit 428afe5084

View file

@ -186,7 +186,7 @@ static struct dyn_obj *dyn_object_find(void *obj)
*
* @return true if successful, false if failed
**/
static bool thread_idx_alloc(u32_t *tidx)
static bool thread_idx_alloc(uintptr_t *tidx)
{
int i;
int idx;
@ -225,7 +225,7 @@ static bool thread_idx_alloc(u32_t *tidx)
*
* @param tidx The thread index to be freed
**/
static void thread_idx_free(u32_t tidx)
static void thread_idx_free(uintptr_t tidx)
{
/* To prevent leaked permission when index is recycled */
z_object_wordlist_foreach(clear_perms_cb, (void *)tidx);
@ -236,7 +236,7 @@ static void thread_idx_free(u32_t tidx)
void *z_impl_k_object_alloc(enum k_objects otype)
{
struct dyn_obj *dyn_obj;
u32_t tidx;
uintptr_t tidx;
/* Stacks are not supported, we don't yet have mem pool APIs
* to request memory that is aligned
@ -353,7 +353,7 @@ static int thread_index_get(struct k_thread *t)
return ko->data;
}
static void unref_check(struct _k_object *ko, int index)
static void unref_check(struct _k_object *ko, uintptr_t index)
{
k_spinlock_key_t key = k_spin_lock(&obj_lock);
@ -445,14 +445,14 @@ void z_thread_perms_clear(struct _k_object *ko, struct k_thread *thread)
static void clear_perms_cb(struct _k_object *ko, void *ctx_ptr)
{
int id = (int)ctx_ptr;
uintptr_t id = (uintptr_t)ctx_ptr;
unref_check(ko, id);
}
void z_thread_perms_all_clear(struct k_thread *thread)
{
int index = thread_index_get(thread);
uintptr_t index = thread_index_get(thread);
if (index != -1) {
z_object_wordlist_foreach(clear_perms_cb, (void *)index);