Alexandru Duțu has submitted this change and it was merged. ( https://gem5-review.googlesource.com/3040 )

Change subject: syscall_emul: Argument retrieval bug fix
......................................................................

syscall_emul: Argument retrieval bug fix

This commit fixes a stack-buffer underflow
by fixing the way the array is indexed.

Change-Id: I44400e2b99a2f8e1f48f673cd110b9dcd6480a72
Reviewed-on: https://gem5-review.googlesource.com/3040
Reviewed-by: Jason Lowe-Power <[email protected]>
Reviewed-by: Andreas Sandberg <[email protected]>
Reviewed-by: Curtis Dunham <[email protected]>
Maintainer: Brandon Potter <[email protected]>
---
M src/sim/syscall_desc.cc
1 file changed, 4 insertions(+), 4 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved
  Andreas Sandberg: Looks good to me, approved
  Curtis Dunham: Looks good to me, approved
  Brandon Potter: Looks good to me, approved



diff --git a/src/sim/syscall_desc.cc b/src/sim/syscall_desc.cc
index 13b5190..3696c17 100644
--- a/src/sim/syscall_desc.cc
+++ b/src/sim/syscall_desc.cc
@@ -54,11 +54,11 @@
     /**
      * 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".
+     * side-effect of the getSyscallArg method.
      */
-    for (int index = 0; index < 6; )
-        arg[index - 1] = process->getSyscallArg(tc, index);
+    int index = 0;
+    for (int i = 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: merged
Gerrit-Change-Id: I44400e2b99a2f8e1f48f673cd110b9dcd6480a72
Gerrit-Change-Number: 3040
Gerrit-PatchSet: 5
Gerrit-Owner: Alexandru Duțu <[email protected]>
Gerrit-Reviewer: Alexandru Duțu <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Brandon Potter <[email protected]>
Gerrit-Reviewer: Curtis Dunham <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Tony Gutierrez <[email protected]>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to