fix segfault from stack corruption in ahbap_debugport_init
authorAndreas Fritiofson <andreas.fritiofson@gmail.com>
Wed, 26 Jan 2011 12:13:14 +0000 (12:13 +0000)
committerSpencer Oliver <ntfreak@users.sourceforge.net>
Wed, 26 Jan 2011 12:14:51 +0000 (12:14 +0000)
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>
src/target/arm_adi_v5.c

index 7df0d4f8ca8bc6349575f0eb7520f3717bc99055..7b801b99de30aa48331d18d84b9833d77db03332 100644 (file)
@@ -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;
 

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)