From: Mitchell Horne <[email protected]>

search_hint is defined in assembly as a .long, and is intended to hold
the initial stack pointer as a hint to the api_search_sig() routine.
Convert this to a uintptr_t, to avoid possible truncation on 64-bit
systems.

Signed-off-by: Mitchell Horne <[email protected]>
---
 examples/api/glue.c | 6 +++---
 examples/api/glue.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/examples/api/glue.c b/examples/api/glue.c
index 91d13157a1..c223306319 100644
--- a/examples/api/glue.c
+++ b/examples/api/glue.c
@@ -42,8 +42,8 @@ static int valid_sig(struct api_signature *sig)
 int api_search_sig(struct api_signature **sig)
 {
        unsigned char *sp;
-       uint32_t search_start = 0;
-       uint32_t search_end = 0;
+       uintptr_t search_start = 0;
+       uintptr_t search_end = 0;
 
        if (sig == NULL)
                return 0;
@@ -51,7 +51,7 @@ int api_search_sig(struct api_signature **sig)
        if (search_hint == 0)
                search_hint = 255 * 1024 * 1024;
 
-       search_start = search_hint & ~0x000fffff;
+       search_start = search_hint & ~0xffffful;
        search_end = search_start + API_SEARCH_LEN - API_SIG_MAGLEN;
 
        sp = (unsigned char *)search_start;
diff --git a/examples/api/glue.h b/examples/api/glue.h
index f9745604b6..dd662fc872 100644
--- a/examples/api/glue.h
+++ b/examples/api/glue.h
@@ -18,7 +18,7 @@
 #define UB_MAX_DEV     6       /* max devices number */
 
 extern void *syscall_ptr;
-extern uint32_t search_hint;
+extern unsigned long search_hint;
 
 int    syscall(int, int *, ...);
 int    api_search_sig(struct api_signature **sig);
-- 
2.26.1

Reply via email to