summaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authorYidi Lin <yidilin@google.com>2026-07-20 13:21:01 +0800
committerYidi Lin <yidilin@google.com>2026-08-05 00:51:14 +0800
commitb062d78c220d710b3f985afde98b7300ee49fec0 (patch)
tree9fbb4641060cad1e58837d43e2ed2c7c114fd7d1 /services
parent4b4636774574635ccaf82b2aa540e451b8374a26 (diff)
downloadarm-trusted-firmware-b062d78c220d710b3f985afde98b7300ee49fec0.tar.gz
arm-trusted-firmware-b062d78c220d710b3f985afde98b7300ee49fec0.zip
fix(optee): correct operand order in dynamic map size calculation
When data_pa is not aligned to a page boundary, mapped_data_pa rounds downwards. Subtracting data_pa directly from mapped_data_pa causes underflow when computing the additional offset needed to cover the alignment gap. Reorder operands to (data_pa - mapped_data_pa) so data_map_size correctly spans the full region across page alignment boundaries. Change-Id: Ie355bb0fb8450c86b5eb3ea9cbad02c42b5e63dc Signed-off-by: Yidi Lin <yidilin@google.com>
Diffstat (limited to 'services')
-rw-r--r--services/spd/opteed/opteed_main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/services/spd/opteed/opteed_main.c b/services/spd/opteed/opteed_main.c
index 6c0ccfd94..afa3263c6 100644
--- a/services/spd/opteed/opteed_main.c
+++ b/services/spd/opteed/opteed_main.c
@@ -516,7 +516,7 @@ static int32_t opteed_handle_smc_load(uint64_t data_size, uint64_t data_pa)
mapped_data_pa = page_align(data_pa, DOWN);
mapped_data_va = mapped_data_pa;
- data_map_size = page_align(data_size + (mapped_data_pa - data_pa), UP);
+ data_map_size = page_align(data_size + (data_pa - mapped_data_pa), UP);
/*
* We do not validate the passed in address because we are trusting the