This is an automated email from Gerrit.

"zapb <[email protected]>" just uploaded a new patch set to Gerrit, which you can 
find at https://review.openocd.org/c/openocd/+/9652

-- gerrit

commit 8e0137700f2f7928d05b957ebf3bb58be9d921b2
Author: Marc Schink <[email protected]>
Date:   Sun May 10 12:20:14 2026 +0000

    rtt: Fix reading inactive channels
    
    The current implementation reads the names of inactive channels, which
    can result in invalid data reads, memory access violations, and broken
    output, for example:
    
    > rtt channellist
    [riscv.cpu] Failed to read memory (addr=0x0)
    {
        {
            name  Terminal
            size  0x400
            flags 0x0
        }
    
    Skip reading the names of inactive channels to avoid invalid memory
    reads and broken output.
    
    Change-Id: Iccc029c9ea1787eb361e4fba8119398abf5dafe1
    Signed-off-by: Marc Schink <[email protected]>

diff --git a/src/target/rtt.c b/src/target/rtt.c
index 6350d3ad09..365a8c9b5e 100644
--- a/src/target/rtt.c
+++ b/src/target/rtt.c
@@ -339,15 +339,18 @@ int target_rtt_read_channel_info(struct target *target,
                return ret;
        }
 
+       info->size = channel.size;
+       info->flags = channel.flags;
+
+       if (!channel_is_active(&channel))
+               return ERROR_OK;
+
        ret = read_channel_name(target, channel.name_addr, info->name,
                info->name_length);
 
        if (ret != ERROR_OK)
                return ret;
 
-       info->size = channel.size;
-       info->flags = channel.flags;
-
        return ERROR_OK;
 }
 

-- 

Reply via email to