summaryrefslogtreecommitdiff
path: root/drivers/io
diff options
context:
space:
mode:
authorSandrine Bailleux <sandrine.bailleux@arm.com>2014-03-19 16:03:48 +0000
committerDan Handley <dan.handley@arm.com>2014-03-21 17:17:48 +0000
commit493c8cb2ae937fb50c2ce53338c9034c5c6636e5 (patch)
tree2d35f462f358eaba4c7ff7b06dc06a4f8b33dbe0 /drivers/io
parent399aacd68f64a98fb9c01d2f63502b869b0e7f70 (diff)
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
Diffstat (limited to 'drivers/io')
-rw-r--r--drivers/io/io_fip.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/io/io_fip.c b/drivers/io/io_fip.c
index 37253721..1eb76faa 100644
--- a/drivers/io/io_fip.c
+++ b/drivers/io/io_fip.c
@@ -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;