Commit 493c8cb2 authored by Sandrine Bailleux's avatar Sandrine Bailleux Committed by Dan Handley
Browse files

Fix file_to_uuid() function

This patch fixes a bug in the 'file_to_uuid()' function: it used
to cause an exception by dereferencing a null pointer when
a given UUID was not found in the UUID array. The fix is to delete
the final null entry in the UUID array, which is not needed because
the array is statically declared so its size is known at build time.

Fixes ARM-software/tf-issues#43

Change-Id: I0a003485b88134564c0d36f57c274215d9e16532
parent 399aacd6
......@@ -67,7 +67,6 @@ static plat_fip_name_uuid name_uuid[] = {
{BL31_IMAGE_NAME, UUID_EL3_RUNTIME_FIRMWARE_BL31},
{BL32_IMAGE_NAME, UUID_SECURE_PAYLOAD_BL32},
{BL33_IMAGE_NAME, UUID_NON_TRUSTED_FIRMWARE_BL33},
{NULL, {0} }
};
static const uuid_t uuid_null = {0};
......@@ -118,7 +117,7 @@ static int file_to_uuid(const char *filename, uuid_t *uuid)
int i;
int status = -EINVAL;
for (i = 0; i < (sizeof(name_uuid)/sizeof(plat_fip_name_uuid)); i++) {
for (i = 0; i < (sizeof(name_uuid) / sizeof(name_uuid[0])); i++) {
if (strcmp(filename, name_uuid[i].name) == 0) {
copy_uuid(uuid, &name_uuid[i].uuid);
status = 0;
......
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