sandbox: use correct type reading /proc/self/maps
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Sat, 26 Oct 2019 21:17:44 +0000 (23:17 +0200)
committerSimon Glass <sjg@chromium.org>
Thu, 14 Nov 2019 13:09:34 +0000 (07:09 -0600)
Compiling arch/sandbox/cpu/os.c results in an error

../arch/sandbox/cpu/os.c: In function ‘os_find_text_base’:
../arch/sandbox/cpu/os.c:823:12: error: cast to pointer from
integer of different size [-Werror=int-to-pointer-cast]
  823 |     base = (void *)addr;
      |            ^
cc1: all warnings being treated as errors

The size of void* differs from that of unsigned long long on 32bit
systems.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
arch/sandbox/cpu/os.c

index 47dfb476d37d46625328f892986195ed746e3d3f..79094fb7f353b4981d9f446c8c0eb6d34d4c3ce0 100644 (file)
@@ -816,10 +816,10 @@ void *os_find_text_base(void)
                char *end = memchr(line, '-', len);
 
                if (end) {
-                       unsigned long long addr;
+                       uintptr_t addr;
 
                        *end = '\0';
-                       if (sscanf(line, "%llx", &addr) == 1)
+                       if (sscanf(line, "%zx", &addr) == 1)
                                base = (void *)addr;
                }
        }