snapshot: use sizeof(*fork_snap)
authorBrian Norris <banorris@uci.edu>
Fri, 5 Apr 2013 21:44:02 +0000 (14:44 -0700)
committerBrian Norris <banorris@uci.edu>
Fri, 5 Apr 2013 23:13:49 +0000 (16:13 -0700)
snapshot.cc

index da478075c8b4f8bde0c4fdfb3bc499f44a79ace9..3ce66d9701c8a116f45e276813bd42071f70b68a 100644 (file)
@@ -285,7 +285,7 @@ static void createSharedMemory()
 
        //Setup snapshot record at top of free region
        fork_snap = (struct fork_snapshotter *)memMapBase;
-       fork_snap->mSharedMemoryBase = (void *)((uintptr_t)memMapBase + sizeof(struct fork_snapshotter));
+       fork_snap->mSharedMemoryBase = (void *)((uintptr_t)memMapBase + sizeof(*fork_snap));
        fork_snap->mStackBase = (void *)((uintptr_t)memMapBase + SHARED_MEMORY_DEFAULT);
        fork_snap->mStackSize = STACK_SIZE_DEFAULT;
        fork_snap->mIDToRollback = -1;
@@ -302,7 +302,7 @@ mspace create_shared_mspace()
 {
        if (!fork_snap)
                createSharedMemory();
-       return create_mspace_with_base((void *)(fork_snap->mSharedMemoryBase), SHARED_MEMORY_DEFAULT - sizeof(struct fork_snapshotter), 1);
+       return create_mspace_with_base((void *)(fork_snap->mSharedMemoryBase), SHARED_MEMORY_DEFAULT - sizeof(*fork_snap), 1);
 }
 
 static void fork_snapshot_init(unsigned int numbackingpages,