From 7042d56c94a48aa4fda1b29c5a874d02e871fbc3 Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Tue, 5 Nov 2024 10:20:00 +0000 Subject: [PATCH] Fix sense of unsigned wrapping test --- src/rp2_common/hardware_xip_cache/xip_cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rp2_common/hardware_xip_cache/xip_cache.c b/src/rp2_common/hardware_xip_cache/xip_cache.c index 2f9e30ab6..c72b7de7d 100644 --- a/src/rp2_common/hardware_xip_cache/xip_cache.c +++ b/src/rp2_common/hardware_xip_cache/xip_cache.c @@ -31,7 +31,8 @@ __always_inline static void check_xip_offset_range(uintptr_t start_offset, uintp (void)size_bytes; valid_params_if(HARDWARE_XIP_CACHE, start_offset <= XIP_CACHE_ADDRESS_SPACE_SIZE); valid_params_if(HARDWARE_XIP_CACHE, start_offset + size_bytes <= XIP_CACHE_ADDRESS_SPACE_SIZE); - valid_params_if(HARDWARE_XIP_CACHE, start_offset + size_bytes <= start_offset); + // Check for unsigned wrapping too: + valid_params_if(HARDWARE_XIP_CACHE, start_offset + size_bytes >= start_offset); } #if !PICO_RP2040