From d390ead56f14c53625c09178c51796232ec3fb97 Mon Sep 17 00:00:00 2001 From: TuxSH Date: Tue, 8 May 2018 00:08:17 +0200 Subject: [PATCH] Fix faulty IRAM check in check_32bit_address_range_in_program --- fusee/fusee-primary/src/utils.h | 2 +- fusee/fusee-secondary/src/utils.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fusee/fusee-primary/src/utils.h b/fusee/fusee-primary/src/utils.h index 246c3acea..924989766 100644 --- a/fusee/fusee-primary/src/utils.h +++ b/fusee/fusee-primary/src/utils.h @@ -80,7 +80,7 @@ static inline bool check_32bit_address_range_loadable(uintptr_t addr, size_t siz return !__builtin_add_overflow_p(addr, size, (uintptr_t)0) && /* the range doesn't overflow */ check_32bit_address_loadable(addr) && check_32bit_address_loadable(addr + size) && /* bounds are valid */ - !(addr >= 0x40010000u && addr + size >= 0x40040000u) /* the range doesn't cross MMIO */ + !(addr >= 0x40010000u && addr < 0x40040000u && addr + size >= 0x40040000u) /* the range doesn't cross MMIO */ ; } diff --git a/fusee/fusee-secondary/src/utils.h b/fusee/fusee-secondary/src/utils.h index 413a4bdf4..7dbeaad03 100644 --- a/fusee/fusee-secondary/src/utils.h +++ b/fusee/fusee-secondary/src/utils.h @@ -80,7 +80,7 @@ static inline bool check_32bit_address_range_loadable(uintptr_t addr, size_t siz return !__builtin_add_overflow_p(addr, size, (uintptr_t)0) && /* the range doesn't overflow */ check_32bit_address_loadable(addr) && check_32bit_address_loadable(addr + size) && /* bounds are valid */ - !(addr >= 0x40010000u && addr + size >= 0x40040000u) /* the range doesn't cross MMIO */ + !(addr >= 0x40010000u && addr < 0x40040000u && addr + size >= 0x40040000u) /* the range doesn't cross MMIO */ ; }