From: Michael Jeanson Date: Thu, 20 Jul 2017 21:33:46 +0000 (-0400) Subject: Fix: assignment from incompatible pointer type warnings X-Git-Tag: v0.9.5~4 X-Git-Url: http://git.liburcu.org/?p=userspace-rcu.git;a=commitdiff_plain;h=181ca7a66672a51c9643b2462de0c537530b2661 Fix: assignment from incompatible pointer type warnings On some platforms, mmap returns a caddr_t pointer which generates compiler warnings, cast to the proper pointer type to eliminate them. Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/urcu-bp.c b/urcu-bp.c index cbdebf4..d0bfb0d 100644 --- a/urcu-bp.c +++ b/urcu-bp.c @@ -373,7 +373,8 @@ void expand_arena(struct registry_arena *arena) sizeof(struct registry_chunk) + sizeof(struct rcu_reader)); new_chunk_len = ARENA_INIT_ALLOC; - new_chunk = mmap(NULL, new_chunk_len, + new_chunk = (struct registry_chunk *) mmap(NULL, + new_chunk_len, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); @@ -407,7 +408,8 @@ void expand_arena(struct registry_arena *arena) } /* Remap did not succeed, we need to add a new chunk. */ - new_chunk = mmap(NULL, new_chunk_len, + new_chunk = (struct registry_chunk *) mmap(NULL, + new_chunk_len, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); @@ -609,7 +611,7 @@ void rcu_bp_exit(void) cds_list_for_each_entry_safe(chunk, tmp, ®istry_arena.chunk_list, node) { - munmap(chunk, chunk->data_len + munmap((void *) chunk, chunk->data_len + sizeof(struct registry_chunk)); } CDS_INIT_LIST_HEAD(®istry_arena.chunk_list);