summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
authorAlexandru Dutu <alexandru.dutu@amd.com>2017-05-02 13:56:36 -0400
committerAlexandru Duțu <alexandru.dutu@amd.com>2017-05-05 22:21:06 +0000
commit8020c689f9d9c77585ef9c5f8c627f1f2a7368f8 (patch)
tree9527d1821acd2bd9c5de69737158505c54161801 /src/sim
parentaa598b3ad1d91e974378f18837f2fbcca909e805 (diff)
downloadgem5-8020c689f9d9c77585ef9c5f8c627f1f2a7368f8.tar.xz
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 <jason@lowepower.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Curtis Dunham <curtis.dunham@arm.com> Maintainer: Brandon Potter <Brandon.Potter@amd.com>
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/syscall_desc.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/sim/syscall_desc.cc b/src/sim/syscall_desc.cc
index 13b519081..3696c1719 100644
--- a/src/sim/syscall_desc.cc
+++ b/src/sim/syscall_desc.cc
@@ -54,11 +54,11 @@ SyscallDesc::doSyscall(int callnum, Process *process, ThreadContext *tc,
/**
* 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