diff options
author | Olivier Deprez <olivier.deprez@arm.com> | 2020-04-03 11:36:30 +0000 |
---|---|---|
committer | TrustedFirmware Code Review <review@review.trustedfirmware.org> | 2020-04-03 11:36:30 +0000 |
commit | 8a53445ebc79d1228f5f930c8ab02b3e7abb2de3 (patch) | |
tree | 45886a28419aa2cfd8b9f7f3f0dff4a86251e770 /include | |
parent | cb2e35b58a1bc370f80d54ce107c858bc60ab612 (diff) | |
parent | afe62624c313b78778d4bb4962f5141ac5a0b728 (diff) | |
download | platform_external_arm-trusted-firmware-8a53445ebc79d1228f5f930c8ab02b3e7abb2de3.tar.gz platform_external_arm-trusted-firmware-8a53445ebc79d1228f5f930c8ab02b3e7abb2de3.tar.bz2 platform_external_arm-trusted-firmware-8a53445ebc79d1228f5f930c8ab02b3e7abb2de3.zip |
Merge changes from topic "sb/fconf" into integration
* changes:
Check for out-of-bound accesses in the platform io policies
Check for out-of-bound accesses in the CoT description
Diffstat (limited to 'include')
-rw-r--r-- | include/drivers/auth/auth_mod.h | 6 | ||||
-rw-r--r-- | include/lib/fconf/fconf_tbbr_getter.h | 7 | ||||
-rw-r--r-- | include/plat/arm/common/arm_fconf_getter.h | 7 |
3 files changed, 17 insertions, 3 deletions
diff --git a/include/drivers/auth/auth_mod.h b/include/drivers/auth/auth_mod.h index 6c48124b5..1dc9ff441 100644 --- a/include/drivers/auth/auth_mod.h +++ b/include/drivers/auth/auth_mod.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -14,6 +14,8 @@ #include <drivers/auth/auth_common.h> #include <drivers/auth/img_parser_mod.h> +#include <lib/utils_def.h> + /* * Image flags */ @@ -41,9 +43,11 @@ int auth_mod_verify_img(unsigned int img_id, /* Macro to register a CoT defined as an array of auth_img_desc_t pointers */ #define REGISTER_COT(_cot) \ const auth_img_desc_t *const *const cot_desc_ptr = (_cot); \ + const size_t cot_desc_size = ARRAY_SIZE(_cot); \ unsigned int auth_img_flags[MAX_NUMBER_IDS] extern const auth_img_desc_t *const *const cot_desc_ptr; +extern const size_t cot_desc_size; extern unsigned int auth_img_flags[MAX_NUMBER_IDS]; #endif /* TRUSTED_BOARD_BOOT */ diff --git a/include/lib/fconf/fconf_tbbr_getter.h b/include/lib/fconf/fconf_tbbr_getter.h index eddc0c4b5..db98b68b0 100644 --- a/include/lib/fconf/fconf_tbbr_getter.h +++ b/include/lib/fconf/fconf_tbbr_getter.h @@ -7,10 +7,15 @@ #ifndef FCONF_TBBR_GETTER_H #define FCONF_TBBR_GETTER_H +#include <assert.h> + #include <lib/fconf/fconf.h> /* TBBR related getter */ -#define tbbr__cot_getter(id) cot_desc_ptr[id] +#define tbbr__cot_getter(id) __extension__ ({ \ + assert((id) < cot_desc_size); \ + cot_desc_ptr[id]; \ +}) #define tbbr__dyn_config_getter(id) tbbr_dyn_config.id diff --git a/include/plat/arm/common/arm_fconf_getter.h b/include/plat/arm/common/arm_fconf_getter.h index 28913a43f..8fd8c7ada 100644 --- a/include/plat/arm/common/arm_fconf_getter.h +++ b/include/plat/arm/common/arm_fconf_getter.h @@ -7,10 +7,15 @@ #ifndef ARM_FCONF_GETTER #define ARM_FCONF_GETTER +#include <assert.h> + #include <lib/fconf/fconf.h> /* ARM io policies */ -#define arm__io_policies_getter(id) &policies[id] +#define arm__io_policies_getter(id) __extension__ ({ \ + assert((id) < MAX_NUMBER_IDS); \ + &policies[id]; \ +}) struct plat_io_policy { uintptr_t *dev_handle; |