summaryrefslogtreecommitdiff
path: root/lib/optee
diff options
context:
space:
mode:
authorYann Gautier <yann.gautier@st.com>2020-11-10 14:47:04 +0100
committerYann Gautier <yann.gautier@st.com>2021-10-07 18:08:01 +0200
commit21d2be83a2eabb328071e857e538ced3c8351874 (patch)
tree63fcff016fd06b804227750d4d9f281084c581b1 /lib/optee
parent5657decc7ffa1376c0a97b6d14ea1428877f5af4 (diff)
fix(lib/optee): correct signedness comparison
Avoid compilation errors with -Wsign-compare : "comparison of integer expressions of different signedness" by changing type of num to uint32_t. And change init_load_addr check. Change-Id: I891e4a288a964ffdb52129813ba8652c5bcf85b2 Signed-off-by: Yann Gautier <yann.gautier@st.com>
Diffstat (limited to 'lib/optee')
-rw-r--r--lib/optee/optee_utils.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/optee/optee_utils.c b/lib/optee/optee_utils.c
index d090b3826..72979cd9d 100644
--- a/lib/optee/optee_utils.c
+++ b/lib/optee/optee_utils.c
@@ -82,11 +82,14 @@ static int parse_optee_image(image_info_t *image_info,
init_size = image->size;
/*
- * -1 indicates loader decided address; take our pre-mapped area
- * for current image since arm-tf could not allocate memory dynamically
+ * image->load_addr_hi & image->load_addr_lo set to UINT32_MAX indicate
+ * loader decided address; take our pre-mapped area for current image
+ * since arm-tf could not allocate memory dynamically
*/
- if (init_load_addr == -1)
+ if ((image->load_addr_hi == UINT32_MAX) &&
+ (image->load_addr_lo == UINT32_MAX)) {
init_load_addr = image_info->image_base;
+ }
/* Check that the default end address doesn't overflow */
if (check_uptr_overflow(image_info->image_base,
@@ -138,7 +141,8 @@ int parse_optee_header(entry_point_info_t *header_ep,
{
optee_header_t *header;
- int num, ret;
+ uint32_t num;
+ int ret;
assert(header_ep);
header = (optee_header_t *)header_ep->pc;
@@ -181,7 +185,7 @@ int parse_optee_header(entry_point_info_t *header_ep,
}
/* Parse OPTEE image */
- for (num = 0; num < header->nb_images; num++) {
+ for (num = 0U; num < header->nb_images; num++) {
if (header->optee_image_list[num].image_id ==
OPTEE_PAGER_IMAGE_ID) {
ret = parse_optee_image(pager_image_info,