This is an automated email from Gerrit.

Hellosun Wu (wujiheng...@gmail.com) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/5341

-- gerrit

commit 1a2418bf4171d5a01f057ae6f58d37d434177808
Author: Hellosun Wu <wujiheng...@gmail.com>
Date:   Tue Nov 5 15:17:21 2019 +0800

    target/riscv: Fix read_memory_progbuf_inner loop
    
    On 32bits machine, the read_memory_progbuf_inner loop will
    get wrong result after (i-2) sign extionsion to uint64_t.
    For example:
    i = 0, read_addr = 0x8, size = 0x4
    The result of 'read_addr + (i-2) * size' will be 0x100000000
    not 0x0
    
    Change-Id: Ic6f773e517d85cdf285e4d47fa5200a6ba392980
    Signed-off-by: Hellosun Wu <wujiheng...@gmail.com>

diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c
index 5683e5a..06e99bf 100644
--- a/src/target/riscv/riscv-013.c
+++ b/src/target/riscv/riscv-013.c
@@ -2233,7 +2233,7 @@ static int read_memory_progbuf_inner(struct target 
*target, target_addr_t addres
 
                /* Now read whatever we got out of the batch. */
                dmi_status_t status = DMI_STATUS_SUCCESS;
-               for (size_t i = 0; i < reads; i++) {
+               for (uint64_t i = 0; i < reads; i++) {
                        riscv_addr_t receive_addr = read_addr + (i-2) * size;
                        assert(receive_addr < address + size * count);
                        if (receive_addr < address)

-- 


_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to