Browse Source

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>
pull/1938/head
Yann Gautier 5 years ago
parent
commit
9543389430
  1. 3
      drivers/st/io/io_stm32image.c

3
drivers/st/io/io_stm32image.c

@ -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…
Cancel
Save