From: OpenOCD-Gerrit <ope...@us...> - 2022-06-10 21:55:06
|
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 7cc79a8d62e0c98b52de04f71ef04167b8055385 (commit) via 54f0cab18efadd7c132021228a3ef04ae1fea3ea (commit) from 95135b39ccc3d8cec79053a71d0289e7fdeeafe9 (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 7cc79a8d62e0c98b52de04f71ef04167b8055385 Author: Antonio Borneo <bor...@gm...> Date: Thu Jun 2 11:17:49 2022 +0200 arm_adi_v5: check for calloc() return value In function adiv5_jim_configure() check that calloc() returns a valid allocated memory pointer. Change-Id: I97287e168834693900341add9d9eb9a5f38c55b4 Signed-off-by: Antonio Borneo <bor...@gm...> Reported-by: Tomas Vanek <va...@fb...> Reviewed-on: https://review.openocd.org/c/openocd/+/7014 Tested-by: jenkins Reviewed-by: Tomas Vanek <va...@fb...> diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index 52b12cb93..4d5f02b32 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -2044,6 +2044,10 @@ int adiv5_jim_configure(struct target *target, struct jim_getopt_info *goi) pc = (struct adiv5_private_config *)target->private_config; if (!pc) { pc = calloc(1, sizeof(struct adiv5_private_config)); + if (!pc) { + LOG_ERROR("Out of memory"); + return JIM_ERR; + } pc->ap_num = DP_APSEL_INVALID; target->private_config = pc; } commit 54f0cab18efadd7c132021228a3ef04ae1fea3ea Author: Antonio Borneo <bor...@gm...> Date: Wed Jun 1 19:47:48 2022 +0200 drivers/bitbang: silence scan-build warning The array is partially initialized with buf_set_u32(,5,32,), then the rest of the array is read from SWD. But scan-build report the array to have garbage content after the initialization, due to the offset of 5 bit that only inits part of the first byte. Silence the false positive from scan-build by initializing the array. Change-Id: Ic38d50280f67939e3ec5fa05741f66d5f993f8c2 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: https://review.openocd.org/c/openocd/+/7013 Tested-by: jenkins Reviewed-by: Tomas Vanek <va...@fb...> diff --git a/src/jtag/drivers/bitbang.c b/src/jtag/drivers/bitbang.c index 898d6d3df..78dcb2947 100644 --- a/src/jtag/drivers/bitbang.c +++ b/src/jtag/drivers/bitbang.c @@ -532,8 +532,9 @@ static void bitbang_swd_write_reg(uint8_t cmd, uint32_t value, uint32_t ap_delay /* Devices do not reply to DP_TARGETSEL write cmd, ignore received ack */ bool check_ack = swd_cmd_returns_ack(cmd); + /* init the array to silence scan-build */ + uint8_t trn_ack_data_parity_trn[DIV_ROUND_UP(4 + 3 + 32 + 1 + 4, 8)] = {0}; for (;;) { - uint8_t trn_ack_data_parity_trn[DIV_ROUND_UP(4 + 3 + 32 + 1 + 4, 8)]; buf_set_u32(trn_ack_data_parity_trn, 1 + 3 + 1, 32, value); buf_set_u32(trn_ack_data_parity_trn, 1 + 3 + 1 + 32, 1, parity_u32(value)); ----------------------------------------------------------------------- Summary of changes: src/jtag/drivers/bitbang.c | 3 ++- src/target/arm_adi_v5.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) hooks/post-receive -- Main OpenOCD repository |