1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-22 20:06:40 +00:00

Fix inverted condition issue in check_32bit_address_range_loadable

This commit is contained in:
TuxSH 2018-05-07 23:57:56 +02:00
parent 1fd098e074
commit 880f49cfa5
3 changed files with 3 additions and 3 deletions

View file

@ -90,7 +90,7 @@ void load_stage2(const char *bct0) {
}
if (!check_32bit_address_range_loadable(config.load_address, size)) {
printk("Error: Stage2 has an invalid load address & size combination!\n");
printk("Error: Stage2 has an invalid load address & size combination (0x%08x 0x%08x)!\n", config.load_address, size);
generic_panic();
}

View file

@ -78,7 +78,7 @@ static inline bool check_32bit_address_loadable(uintptr_t addr) {
static inline bool check_32bit_address_range_loadable(uintptr_t addr, size_t size) {
return
__builtin_add_overflow_p(addr, size, (uintptr_t)0) && /* the range doesn't overflow */
!__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 */
;

View file

@ -78,7 +78,7 @@ static inline bool check_32bit_address_loadable(uintptr_t addr) {
static inline bool check_32bit_address_range_loadable(uintptr_t addr, size_t size) {
return
__builtin_add_overflow_p(addr, size, (uintptr_t)0) && /* the range doesn't overflow */
!__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 */
;