diff options
author | Andreas Fritiofson <andreas.fritiofson@gmail.com> | 2011-01-26 12:13:14 +0000 |
---|---|---|
committer | Spencer Oliver <ntfreak@users.sourceforge.net> | 2011-01-26 12:14:51 +0000 |
commit | 5b34018ccd244e888e8b7e1619e0e979b2a6147e (patch) | |
tree | e4b1e734bf8dc90385796628fb8eb8f52eb49440 /src | |
parent | a72741818431d693e48b0f016258be0fec1f79da (diff) | |
download | openocd+libswd-5b34018ccd244e888e8b7e1619e0e979b2a6147e.tar.gz openocd+libswd-5b34018ccd244e888e8b7e1619e0e979b2a6147e.tar.bz2 openocd+libswd-5b34018ccd244e888e8b7e1619e0e979b2a6147e.tar.xz openocd+libswd-5b34018ccd244e888e8b7e1619e0e979b2a6147e.zip |
fix segfault from stack corruption in ahbap_debugport_init
ahbap_debugport_init was queueing reads to a local stack variable but
didn't execute the queue before returning. Since the result of the reads
are not used anyway, it's better to pass NULL as the destination instead of
a dummy variable. I changed this throughout the function, even for the
reads that were actually executed.
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/target/arm_adi_v5.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index 7df0d4f8..7b801b99 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -906,7 +906,6 @@ extern const struct dap_ops jtag_dp_ops; */ int ahbap_debugport_init(struct adiv5_dap *dap) { - uint32_t dummy; uint32_t ctrlstat; int cnt = 0; int retval; @@ -931,7 +930,7 @@ int ahbap_debugport_init(struct adiv5_dap *dap) /* DP initialization */ - retval = dap_queue_dp_read(dap, DP_CTRL_STAT, &dummy); + retval = dap_queue_dp_read(dap, DP_CTRL_STAT, NULL); if (retval != ERROR_OK) return retval; @@ -939,7 +938,7 @@ int ahbap_debugport_init(struct adiv5_dap *dap) if (retval != ERROR_OK) return retval; - retval = dap_queue_dp_read(dap, DP_CTRL_STAT, &dummy); + retval = dap_queue_dp_read(dap, DP_CTRL_STAT, NULL); if (retval != ERROR_OK) return retval; @@ -977,7 +976,7 @@ int ahbap_debugport_init(struct adiv5_dap *dap) alive_sleep(10); } - retval = dap_queue_dp_read(dap, DP_CTRL_STAT, &dummy); + retval = dap_queue_dp_read(dap, DP_CTRL_STAT, NULL); if (retval != ERROR_OK) return retval; /* With debug power on we can activate OVERRUN checking */ @@ -985,7 +984,7 @@ int ahbap_debugport_init(struct adiv5_dap *dap) retval = dap_queue_dp_write(dap, DP_CTRL_STAT, dap->dp_ctrl_stat); if (retval != ERROR_OK) return retval; - retval = dap_queue_dp_read(dap, DP_CTRL_STAT, &dummy); + retval = dap_queue_dp_read(dap, DP_CTRL_STAT, NULL); if (retval != ERROR_OK) return retval; |