mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2026-07-02 01:04:41 +00:00
The overlap validation in overlapping_memory_regions() performed
page_count * PAGE_SIZE_4KB using 32-bit arithmetic, which could
overflow for large page_count values and result in incorrect
overlap detection.
This change:
- Casts page_count to uint64_t before multiplication to ensure
correct 64-bit arithmetic.
- Adds explicit overflow guards for the multiplication.
- Uses check_u64_overflow() to detect wrap-around before computing
region_end.
This prevents validation bypass due to integer overflow and
strengthens arithmetic robustness in EL3 SPMC memory transaction
handling.
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
Change-Id: I7b16a3267f1fefafa3207b7d66fd6fb8aa30b417
(cherry picked from commit 6a4449471f)