|
From: openocd-gerrit <ope...@us...> - 2022-12-03 09:26:36
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 3ea1bfce4faf656d0506c194084807f1e498abff (commit)
from 0f034868f2c90741e57c5e27121e292b1774c080 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 3ea1bfce4faf656d0506c194084807f1e498abff
Author: Antonio Borneo <bor...@gm...>
Date: Wed Nov 16 23:06:12 2022 +0100
jtag: xds110: fix clang error core.StackAddressEscape
Clang ignores that xds110_swd_write_reg() is always called with
bit SWD_CMD_RNW in 'cmd' set to zero.
It then complains that the local variable 'value' gets passed by
address to xds110_swd_queue_cmd() and in case of 'read request'
such stack address get stored for later use:
src/jtag/drivers/xds110.c:1363:1: warning: Address of
stack memory associated with local variable 'value' is
still referred to by the global variable 'xds110' upon
returning to the caller. This will be a dangling
reference [core.StackAddressEscape]
To both xds110_swd_write_reg() and xds110_swd_read_reg(), add an
assert() to inform Clang about the state of bit SWD_CMD_RNW.
Change-Id: I7687c055ec71424b642e152f478723a930966e3a
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7380
Tested-by: jenkins
diff --git a/src/jtag/drivers/xds110.c b/src/jtag/drivers/xds110.c
index ecba36bb9..8e5d638db 100644
--- a/src/jtag/drivers/xds110.c
+++ b/src/jtag/drivers/xds110.c
@@ -1354,11 +1354,13 @@ static void xds110_swd_queue_cmd(uint8_t cmd, uint32_t *value)
static void xds110_swd_read_reg(uint8_t cmd, uint32_t *value,
uint32_t ap_delay_clk)
{
+ assert(cmd & SWD_CMD_RNW);
xds110_swd_queue_cmd(cmd, value);
}
static void xds110_swd_write_reg(uint8_t cmd, uint32_t value,
uint32_t ap_delay_clk)
{
+ assert(!(cmd & SWD_CMD_RNW));
xds110_swd_queue_cmd(cmd, &value);
}
-----------------------------------------------------------------------
Summary of changes:
src/jtag/drivers/xds110.c | 2 ++
1 file changed, 2 insertions(+)
hooks/post-receive
--
Main OpenOCD repository
|