summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Kirspel <kevin-kirspel@idexx.com>2017-07-19 10:59:16 -0400
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-07-20 07:25:43 +0200
commitbb01a36dfb59d3cdccd33178d2b6be7f479e3d87 (patch)
treea37ede188abe931ea6ef6720e22e3e82f4b5c345
parentsptests/sptls02: Use standard test IO (diff)
downloadrtems-bb01a36dfb59d3cdccd33178d2b6be7f479e3d87.tar.bz2
Fixed issue with searching mapped addresses
The loop that checks if the current address is already mapped uses the same local variable for the chanin node as the newly allocated chain node so the allocated chain node gets over written. Added a new local variable for the loop that checks the address Updates #2859.
-rw-r--r--cpukit/posix/src/mmap.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/cpukit/posix/src/mmap.c b/cpukit/posix/src/mmap.c
index d9b663dd1e..e53cafa5c9 100644
--- a/cpukit/posix/src/mmap.c
+++ b/cpukit/posix/src/mmap.c
@@ -114,6 +114,7 @@ void *mmap(
{
struct stat sb;
mmap_mapping *mapping;
+ mmap_mapping *current_mapping;
ssize_t r;
rtems_libio_t *iop;
bool map_fixed;
@@ -319,9 +320,9 @@ void *mmap(
* error. POSIX allows us to also return successfully by unmapping
* the overlapping prior mappings.
*/
- mapping = (mmap_mapping*) node;
- if ( ( addr >= mapping->addr ) &&
- ( addr < ( mapping->addr + mapping->len )) ) {
+ current_mapping = (mmap_mapping*) node;
+ if ( ( addr >= current_mapping->addr ) &&
+ ( addr < ( current_mapping->addr + current_mapping->len )) ) {
free( mapping );
mmap_mappings_lock_release( );
errno = ENXIO;