diff options
author | Yann Gautier <yann.gautier@foss.st.com> | 2022-06-20 11:24:22 +0200 |
---|---|---|
committer | Yann Gautier <yann.gautier@st.com> | 2022-06-22 14:48:35 +0200 |
commit | c0a11cd8698394e1d3d3d7c9cedb19846ba59223 (patch) | |
tree | a745a7140647e8ce08d7341ff7a3fb4a93bc807c /lib/optee | |
parent | daa4df63c683698462429f1b7e56dea28f8d0502 (diff) |
feat(optee): check paged_image_info
For OP-TEE without pager, the paged image may not be present in OP-TEE
header. We could then pass NULL for paged_image_info to the function
parse_optee_header(). It avoids creating a useless struct for that
non existing image. But we should then avoid assigning header_ep args
that depend on paged_image_info.
Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
Change-Id: I4fdb45a91ac1ba6f912d6130813f5215c7e28c8b
Diffstat (limited to 'lib/optee')
-rw-r--r-- | lib/optee/optee_utils.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/optee/optee_utils.c b/lib/optee/optee_utils.c index 72979cd9d..d30248fa2 100644 --- a/lib/optee/optee_utils.c +++ b/lib/optee/optee_utils.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2021, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2022, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -192,8 +192,17 @@ int parse_optee_header(entry_point_info_t *header_ep, &header->optee_image_list[num]); } else if (header->optee_image_list[num].image_id == OPTEE_PAGED_IMAGE_ID) { - ret = parse_optee_image(paged_image_info, - &header->optee_image_list[num]); + if (paged_image_info == NULL) { + if (header->optee_image_list[num].size != 0U) { + ERROR("Paged image is not supported\n"); + return -1; + } + + continue; + } else { + ret = parse_optee_image(paged_image_info, + &header->optee_image_list[num]); + } } else { ERROR("Parse optee image failed.\n"); return -1; @@ -215,8 +224,10 @@ int parse_optee_header(entry_point_info_t *header_ep, * header image arguments so that can be read by the * BL32 SPD. */ - header_ep->args.arg1 = paged_image_info->image_base; - header_ep->args.arg2 = paged_image_info->image_size; + if (paged_image_info != NULL) { + header_ep->args.arg1 = paged_image_info->image_base; + header_ep->args.arg2 = paged_image_info->image_size; + } /* Set OPTEE runtime arch - aarch32/aarch64 */ if (header->arch == 0) { |