Alexandru Duțu has uploaded this change for review. ( https://gem5-review.googlesource.com/3040

Change subject: syscall_emul: Argument retrieval bug fix This commit fixes a stack-buffer underflow by fixing the way the array is indexed.
......................................................................

syscall_emul: Argument retrieval bug fix
This commit fixes a stack-buffer underflow
by fixing the way the array is indexed.

Change-Id: I44400e2b99a2f8e1f48f673cd110b9dcd6480a72
---
M src/sim/syscall_desc.cc
1 file changed, 3 insertions(+), 5 deletions(-)



diff --git a/src/sim/syscall_desc.cc b/src/sim/syscall_desc.cc
index 13b5190..7c948fa 100644
--- a/src/sim/syscall_desc.cc
+++ b/src/sim/syscall_desc.cc
@@ -53,12 +53,10 @@

     /**
      * Step through the first six parameters for the system call and
-     * retrieve their values. Note that index is incremented as a
-     * side-effect of the getSyscallArg method which is why the LHS
-     * needs the "-1".
+     * retrieve their values.
      */
-    for (int index = 0; index < 6; )
-        arg[index - 1] = process->getSyscallArg(tc, index);
+    for (int i = 0, index = 0; i < 6; i++)
+        arg[i] = process->getSyscallArg(tc, index);

     /**
      * Linux supports up to six system call arguments through registers

--
To view, visit https://gem5-review.googlesource.com/3040
To unsubscribe, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I44400e2b99a2f8e1f48f673cd110b9dcd6480a72
Gerrit-Change-Number: 3040
Gerrit-PatchSet: 1
Gerrit-Owner: Alexandru Duțu <[email protected]>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to