From: OpenOCD-Gerrit <ope...@us...> - 2020-11-04 17:36:08
|
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 49b7099def030accbceb9a92782fb389d04e8e09 (commit) via a932810f9d55256caea8c65a79506e838a17c316 (commit) via cd19f466885d542cfee16d5341369b3c445a696f (commit) from 91c4c83f44760f323f3bcab44c89ac59b4ed74c7 (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 49b7099def030accbceb9a92782fb389d04e8e09 Author: Tomas Vanek <va...@fb...> Date: Thu Oct 29 19:57:20 2020 +0100 gdb_server: fix clang static analyzer warning Warning: line 373, column 15 Assigned value is garbage or undefined Most probably a false warning, building the hex string byte per byte seems too complicated for static analyze. Change malloc to calloc to silence the warning. Change-Id: I746d43fa51abf05582ccf2680ed72dc557798a7a Signed-off-by: Tomas Vanek <va...@fb...> Reviewed-on: http://openocd.zylin.com/5905 Reviewed-by: Antonio Borneo <bor...@gm...> Tested-by: jenkins Reviewed-by: Jonathan McDowell <noo...@ea...> diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index c36966554..1a209a769 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -1332,7 +1332,7 @@ static int gdb_get_register_packet(struct connection *connection, } } - reg_packet = malloc(DIV_ROUND_UP(reg_list[reg_num]->size, 8) * 2 + 1); /* plus one for string termination null */ + reg_packet = calloc(DIV_ROUND_UP(reg_list[reg_num]->size, 8) * 2 + 1, 1); /* plus one for string termination null */ gdb_str_to_target(target, reg_packet, reg_list[reg_num]); commit a932810f9d55256caea8c65a79506e838a17c316 Author: Tomas Vanek <va...@fb...> Date: Thu Oct 29 18:32:13 2020 +0100 helper/command: fix clang static analyzer warning Warning: line 955, column 3 Argument to free() is the address of a global variable, which is not memory allocated by malloc() It is definitely a false alarm. Simplify concatenation of arguments and allocate a string always to silence the warning. Change-Id: I5ac4cc610fc35224df0b16ef4f7102700363249f Signed-off-by: Tomas Vanek <va...@fb...> Reviewed-on: http://openocd.zylin.com/5904 Reviewed-by: Antonio Borneo <bor...@gm...> Tested-by: jenkins Reviewed-by: Andreas Fritiofson <and...@gm...> diff --git a/src/helper/command.c b/src/helper/command.c index 271e7b993..773195e2f 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -920,39 +920,29 @@ COMMAND_HANDLER(handle_help_command) bool full = strcmp(CMD_NAME, "help") == 0; int retval; struct command *c = CMD_CTX->commands; - char *cmd_match = NULL; - - if (CMD_ARGC == 0) - cmd_match = ""; - else if (CMD_ARGC >= 1) { - unsigned i; - - for (i = 0; i < CMD_ARGC; ++i) { - if (NULL != cmd_match) { - char *prev = cmd_match; - - cmd_match = alloc_printf("%s %s", cmd_match, CMD_ARGV[i]); - free(prev); - if (NULL == cmd_match) { - LOG_ERROR("unable to build search string"); - return -ENOMEM; - } - } else { - cmd_match = alloc_printf("%s", CMD_ARGV[i]); - if (NULL == cmd_match) { - LOG_ERROR("unable to build search string"); - return -ENOMEM; - } - } + char *cmd_match; + + if (CMD_ARGC <= 0) + cmd_match = strdup(""); + + else { + cmd_match = strdup(CMD_ARGV[0]); + + for (unsigned int i = 1; i < CMD_ARGC && cmd_match; ++i) { + char *prev = cmd_match; + cmd_match = alloc_printf("%s %s", prev, CMD_ARGV[i]); + free(prev); } - } else - return ERROR_COMMAND_SYNTAX_ERROR; + } + if (cmd_match == NULL) { + LOG_ERROR("unable to build search string"); + return -ENOMEM; + } retval = CALL_COMMAND_HANDLER(command_help_show_list, c, 0, full, cmd_match); - if (CMD_ARGC >= 1) - free(cmd_match); + free(cmd_match); return retval; } commit cd19f466885d542cfee16d5341369b3c445a696f Author: Tomas Vanek <va...@fb...> Date: Thu Oct 29 18:15:33 2020 +0100 flash/nor/atsamv: fix clang static analyzer warning Warning: line 679, column 4 4th function call argument is an uninitialized value Change-Id: If62d96e1595be945c8e17885bb402e820fb1ec7b Signed-off-by: Tomas Vanek <va...@fb...> Reviewed-on: http://openocd.zylin.com/5903 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> Reviewed-by: Jonathan McDowell <noo...@ea...> diff --git a/src/flash/nor/atsamv.c b/src/flash/nor/atsamv.c index af48398e0..8f1450bf7 100644 --- a/src/flash/nor/atsamv.c +++ b/src/flash/nor/atsamv.c @@ -676,6 +676,9 @@ showall: } if ((who >= 0) && (((unsigned)who) < SAMV_NUM_GPNVM_BITS)) { r = samv_get_gpnvm(target, who, &v); + if (r != ERROR_OK) + return r; + command_print(CMD, "samv-gpnvm%u: %u", who, v); return r; } else { ----------------------------------------------------------------------- Summary of changes: src/flash/nor/atsamv.c | 3 +++ src/helper/command.c | 46 ++++++++++++++++++---------------------------- src/server/gdb_server.c | 2 +- 3 files changed, 22 insertions(+), 29 deletions(-) hooks/post-receive -- Main OpenOCD repository |