fix(lib/psa): fix Null pointer dereference error

Fixing possible Null pointer dereference error, found
by Coverity scan.

Change-Id: If60b7f7e13ecbc3c01e3a9c5005c480260bbabdd
Signed-off-by: David Vincze <david.vincze@arm.com>
This commit is contained in:
David Vincze 2022-05-18 16:02:37 +02:00
parent 453abc80b2
commit c32ab75c41

View file

@ -16,12 +16,11 @@
static void print_byte_array(const uint8_t *array, size_t len) static void print_byte_array(const uint8_t *array, size_t len)
{ {
unsigned int i; size_t i;
if (array == NULL || len == 0U) { if (array == NULL || len == 0U) {
(void)printf("\n"); (void)printf("\n");
} } else {
for (i = 0U; i < len; ++i) { for (i = 0U; i < len; ++i) {
(void)printf(" %02x", array[i]); (void)printf(" %02x", array[i]);
if ((i & U(0xF)) == U(0xF)) { if ((i & U(0xF)) == U(0xF)) {
@ -31,6 +30,7 @@ static void print_byte_array(const uint8_t *array, size_t len)
} }
} }
} }
}
} }
static void log_measurement(uint8_t index, static void log_measurement(uint8_t index,