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,18 +16,18 @@
static void print_byte_array(const uint8_t *array, size_t len)
{
unsigned int i;
size_t i;
if (array == NULL || len == 0U) {
(void)printf("\n");
}
for (i = 0U; i < len; ++i) {
(void)printf(" %02x", array[i]);
if ((i & U(0xF)) == U(0xF)) {
(void)printf("\n");
if (i < (len - 1U)) {
INFO("\t\t:");
} else {
for (i = 0U; i < len; ++i) {
(void)printf(" %02x", array[i]);
if ((i & U(0xF)) == U(0xF)) {
(void)printf("\n");
if (i < (len - 1U)) {
INFO("\t\t:");
}
}
}
}