Commit 95433894 authored by Yann Gautier's avatar Yann Gautier
Browse files

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: default avatarYann Gautier <yann.gautier@st.com>
parent e9d1e5af
...@@ -247,7 +247,7 @@ static int stm32image_partition_read(io_entity_t *entity, uintptr_t buffer, ...@@ -247,7 +247,7 @@ static int stm32image_partition_read(io_entity_t *entity, uintptr_t buffer,
size_t length, size_t *length_read) size_t length, size_t *length_read)
{ {
int result; int result;
uint8_t *local_buffer = (uint8_t *)buffer; uint8_t *local_buffer;
boot_api_image_header_t *header = boot_api_image_header_t *header =
(boot_api_image_header_t *)first_lba_buffer; (boot_api_image_header_t *)first_lba_buffer;
...@@ -255,6 +255,7 @@ static int stm32image_partition_read(io_entity_t *entity, uintptr_t buffer, ...@@ -255,6 +255,7 @@ static int stm32image_partition_read(io_entity_t *entity, uintptr_t buffer,
assert(buffer != 0U); assert(buffer != 0U);
assert(length_read != NULL); assert(length_read != NULL);
local_buffer = (uint8_t *)buffer;
*length_read = 0U; *length_read = 0U;
while (*length_read == 0U) { while (*length_read == 0U) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment