From: OpenOCD-Gerrit <ope...@us...> - 2021-08-22 10:46:34
|
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 91b5626e7fa7f30b1c5c8b69cf1decf33e892c42 (commit) from 88c3e767b29b2aeec6f9290cfb9efb749b4d6f82 (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 91b5626e7fa7f30b1c5c8b69cf1decf33e892c42 Author: Tarek BOCHKATI <tar...@gm...> Date: Thu Jul 29 22:05:18 2021 +0100 flash/stm32l4x: use COMMAND_PARSE_NUMBER in command handlers the usage of COMMAND_PARSE_NUMBER is safer in COMMAND_HANDLERs since it provides better error checking than strto** functions. Change-Id: I7e113b06b74f2d8d9cc4c0ce1957994a1c49c964 Signed-off-by: Tarek BOCHKATI <tar...@gm...> Reviewed-on: https://review.openocd.org/c/openocd/+/6419 Reviewed-by: Antonio Borneo <bor...@gm...> Reviewed-by: Paul Fertser <fer...@gm...> Tested-by: jenkins diff --git a/src/flash/nor/stm32l4x.c b/src/flash/nor/stm32l4x.c index 7d6c90028..d770cdfa5 100644 --- a/src/flash/nor/stm32l4x.c +++ b/src/flash/nor/stm32l4x.c @@ -1734,7 +1734,7 @@ COMMAND_HANDLER(stm32l4_handle_option_read_command) uint32_t reg_offset, reg_addr; uint32_t value = 0; - reg_offset = strtoul(CMD_ARGV[1], NULL, 16); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], reg_offset); reg_addr = stm32l4_get_flash_reg(bank, reg_offset); retval = stm32l4_read_flash_reg(bank, reg_offset, &value); @@ -1762,10 +1762,11 @@ COMMAND_HANDLER(stm32l4_handle_option_write_command) uint32_t value = 0; uint32_t mask = 0xFFFFFFFF; - reg_offset = strtoul(CMD_ARGV[1], NULL, 16); - value = strtoul(CMD_ARGV[2], NULL, 16); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], reg_offset); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], value); + if (CMD_ARGC > 3) - mask = strtoul(CMD_ARGV[3], NULL, 16); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[3], mask); command_print(CMD, "%s Option written.\n" "INFO: a reset or power cycle is required " ----------------------------------------------------------------------- Summary of changes: src/flash/nor/stm32l4x.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) hooks/post-receive -- Main OpenOCD repository |