From a53fbc9b19eee875c4ef5c3fff85826c73839a6f Mon Sep 17 00:00:00 2001
From: Joshua Saxby <Joshua2.Saxby@live.uwe.ac.uk>
Date: Mon, 2 Dec 2019 16:42:02 +0000
Subject: [PATCH] Fix issue where void pointers were being dereferenced In
 calls to move_stack_pointer(), intial_stack_pointer should not be
 dereferenced in the call This was causing page faults but this has now been
 corrected

---
 userprog/populate_stack.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/userprog/populate_stack.c b/userprog/populate_stack.c
index 2ac4652..d82e18f 100644
--- a/userprog/populate_stack.c
+++ b/userprog/populate_stack.c
@@ -29,27 +29,27 @@ void populate_stack(void** stack_pointer, int argc, char** argv) {
 		memcpy(*stack_pointer, argv[i], strlen(argv[i]) + 1);
 	}
 
-    move_stack_pointer(*stack_pointer, -4); //Moves the stack pointer back 4
+    move_stack_pointer(stack_pointer, -4); //Moves the stack pointer back 4
 
 	(*(int *)(*stack_pointer)) = 0;//sentinel          
 	i = argc;
 
 	while (--i >= 0)
 	{
-		move_stack_pointer(*stack_pointer, -4); //32bit  Moves the stack pointer back 4
+		move_stack_pointer(stack_pointer, -4); //32bit  Moves the stack pointer back 4
 
 		(*(uint32_t **)(*stack_pointer)) = arr[i];
 	}
 	
-	move_stack_pointer(*stack_pointer, -4);
-    move_stack_pointer(*stack_pointer, 4); //Moves the stack pointer forwards 4
+	move_stack_pointer(stack_pointer, -4);
+    move_stack_pointer(stack_pointer, 4); //Moves the stack pointer forwards 4
     // TODO: Test if still required in later version
     
 	(*(uintptr_t  **)(*stack_pointer)) = *stack_pointer;
-	move_stack_pointer(*stack_pointer, -4); //Moves the stack pointer back 4
+	move_stack_pointer(stack_pointer, -4); //Moves the stack pointer back 4
 
 	*(int *)(*stack_pointer) = argc;
-	move_stack_pointer(*stack_pointer, -4); //Moves the stack pointer back 4
+	move_stack_pointer(stack_pointer, -4); //Moves the stack pointer back 4
 
 	(*(int *)(*stack_pointer)) = 0;
 }
\ No newline at end of file
-- 
GitLab