[PATCH] posix: fix warnings with mmap from heap/wkspace

Gedare Bloom gedare at rtems.org
Mon Jul 24 19:11:08 UTC 2017


Avoid void pointer arithmetic.

Updates #2859.
---
 cpukit/posix/src/shmheap.c    | 2 +-
 cpukit/posix/src/shmwkspace.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/cpukit/posix/src/shmheap.c b/cpukit/posix/src/shmheap.c
index 47f5b47..b36fc28 100644
--- a/cpukit/posix/src/shmheap.c
+++ b/cpukit/posix/src/shmheap.c
@@ -105,6 +105,6 @@ void * _POSIX_Shm_Object_mmap_from_heap(
     return NULL;
   }
 
-  return &(shm_obj->handle[off]);
+  return (char*)shm_obj->handle + off;
 }
 
diff --git a/cpukit/posix/src/shmwkspace.c b/cpukit/posix/src/shmwkspace.c
index bcef353..cfe4d01 100644
--- a/cpukit/posix/src/shmwkspace.c
+++ b/cpukit/posix/src/shmwkspace.c
@@ -90,6 +90,6 @@ void * _POSIX_Shm_Object_mmap_from_workspace(
     return NULL;
   }
 
-  return &(shm_obj->handle[off]);
+  return (char*)shm_obj->handle + off;
 }
 
-- 
2.7.4



More information about the devel mailing list