summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSandrine Bailleux <sandrine.bailleux@arm.com>2016-04-22 10:47:33 +0100
committerSandrine Bailleux <sandrine.bailleux@arm.com>2016-04-26 14:59:38 +0100
commitaa447b9c501c649628ef0f646f59befa79126bd0 (patch)
treef22a51730508a6aba53438896618ba1689f0cc94 /lib
parent142ff9b5f5d80d0c5e5a235f5c80570a535c7e72 (diff)
Fix computation of L1 bitmask in the translation table lib
This patch fixes the computation of the bitmask used to isolate the level 1 field of a virtual address. The whole computation needs to work on 64-bit values to produce the correct bitmask value. XLAT_TABLE_ENTRIES_MASK being a C constant, it is a 32-bit value so it needs to be extended to a 64-bit value before it takes part in any other computation. This patch fixes this bug by casting XLAT_TABLE_ENTRIES_MASK as an unsigned long long. Note that this bug doesn't manifest itself in practice because address spaces larger than 39 bits are not yet supported in the Trusted Firmware. Change-Id: I955fd263ecb691ca94b29b9c9f576008ce1d87ee
Diffstat (limited to 'lib')
-rw-r--r--lib/xlat_tables/xlat_tables_common.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/xlat_tables/xlat_tables_common.c b/lib/xlat_tables/xlat_tables_common.c
index 54c528cd..fd100846 100644
--- a/lib/xlat_tables/xlat_tables_common.c
+++ b/lib/xlat_tables/xlat_tables_common.c
@@ -284,8 +284,9 @@ static mmap_region_t *init_xlation_table_inner(mmap_region_t *mm,
unsigned level_size_shift = L1_XLAT_ADDRESS_SHIFT - (level - 1) *
XLAT_TABLE_ENTRIES_SHIFT;
unsigned level_size = 1 << level_size_shift;
- unsigned long long level_index_mask = XLAT_TABLE_ENTRIES_MASK <<
- level_size_shift;
+ unsigned long long level_index_mask =
+ ((unsigned long long) XLAT_TABLE_ENTRIES_MASK)
+ << level_size_shift;
assert(level > 0 && level <= 3);