io: io_stm32image: correct possible NULL pointer dereference
This issue was found with cppcheck in our downstream code: [drivers/st/io/io_stm32image.c:234] -> [drivers/st/io/io_stm32image.c:244]: (warning) Either the condition 'buffer!=0U' is redundant or there is possible null pointer dereference: local_buffer. Change-Id: Ieb615b7e485dc93bbeeed4cd8bf845eb84c14ac9 Signed-off-by: Yann Gautier <yann.gautier@st.com>
This commit is contained in:
parent
e9d1e5afbd
commit
9543389430
|
@ -247,7 +247,7 @@ static int stm32image_partition_read(io_entity_t *entity, uintptr_t buffer,
|
|||
size_t length, size_t *length_read)
|
||||
{
|
||||
int result;
|
||||
uint8_t *local_buffer = (uint8_t *)buffer;
|
||||
uint8_t *local_buffer;
|
||||
boot_api_image_header_t *header =
|
||||
(boot_api_image_header_t *)first_lba_buffer;
|
||||
|
||||
|
@ -255,6 +255,7 @@ static int stm32image_partition_read(io_entity_t *entity, uintptr_t buffer,
|
|||
assert(buffer != 0U);
|
||||
assert(length_read != NULL);
|
||||
|
||||
local_buffer = (uint8_t *)buffer;
|
||||
*length_read = 0U;
|
||||
|
||||
while (*length_read == 0U) {
|
||||
|
|
Loading…
Reference in New Issue