From d57b76dfd8ca21ac4c71d49edc16aa35570e838e Mon Sep 17 00:00:00 2001 From: Gianluca Scopelliti Date: Tue, 26 Oct 2021 15:45:16 +0200 Subject: [PATCH] fix: cast from void* to uintptr_t inside is_buffer_outside_region --- src/sancus_support/sm_support.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/sancus_support/sm_support.h b/src/sancus_support/sm_support.h index 9f33c64..12264ef 100644 --- a/src/sancus_support/sm_support.h +++ b/src/sancus_support/sm_support.h @@ -313,9 +313,13 @@ sm_id sancus_enable_wrapped(struct SancusModule* sm, unsigned nonce, void* tag); * Returns true if buf is outside the memory region [start, end) * if start >= end, immediately return false */ -always_inline int is_buffer_outside_region(uintptr_t start, uintptr_t end, - uintptr_t buf, size_t len) { +always_inline int is_buffer_outside_region(void *start_p, void *end_p, + void *buf_p, size_t len) { + uintptr_t start = (uintptr_t) start_p; + uintptr_t end = (uintptr_t) end_p; + uintptr_t buf = (uintptr_t) buf_p; uintptr_t buf_end; + // make sure start < end, otherwise return false if (start >= end) { return 0;