From: OpenOCD-Gerrit <ope...@us...> - 2021-03-16 08:52:27
|
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 8d6f7c92239a54ce77d7a268f51b49445470fe00 (commit) from 4c00f96fc2e32397da5b46ca3428a992333548da (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 8d6f7c92239a54ce77d7a268f51b49445470fe00 Author: Raúl Sanchez Siles <ras...@gm...> Date: Sat Mar 13 01:09:01 2021 +0100 flash/stm32l4x: zero init stm32l4_flash_bank struct on flash bank initialization This is specially needed when, in the probe routine, device is not found among the stm32l4_parts. In this case, the stm32l4_flash_bank->part_info is undefined and inadvertentanly used afterwards: part_info = stm32l4_info->part_info; If the stm32l4_flash_bank is zero init, the probe routine checks for the validity of the part_info field in the previous struct and correctly detects the unsupported (or not found) condition, raising an error rather than a SIGSEGV Change-Id: I7d9d669fb3fa7f8f0903acd60046966b4acb0031 Signed-off-by: Raúl Sánchez Siles <ras...@gm...> Reviewed-on: http://openocd.zylin.com/6103 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tar...@gm...> Reviewed-by: Oleksij Rempel <li...@re...> Reviewed-by: Tomas Vanek <va...@fb...> diff --git a/src/flash/nor/stm32l4x.c b/src/flash/nor/stm32l4x.c index 55a8d8ff3..89c5ac3fe 100644 --- a/src/flash/nor/stm32l4x.c +++ b/src/flash/nor/stm32l4x.c @@ -439,7 +439,7 @@ FLASH_BANK_COMMAND_HANDLER(stm32l4_flash_bank_command) if (CMD_ARGC < 6) return ERROR_COMMAND_SYNTAX_ERROR; - stm32l4_info = malloc(sizeof(struct stm32l4_flash_bank)); + stm32l4_info = calloc(1, sizeof(struct stm32l4_flash_bank)); if (!stm32l4_info) return ERROR_FAIL; /* Checkme: What better error to use?*/ bank->driver_priv = stm32l4_info; ----------------------------------------------------------------------- Summary of changes: src/flash/nor/stm32l4x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- Main OpenOCD repository |