[U-Boot] [PATCH 1/1] sandbox: use correct type reading /proc/self/maps

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 --- arch/sandbox/cpu/os.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 47dfb476d3..79094fb7f3 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -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; } } -- 2.23.0

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 --- arch/sandbox/cpu/os.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 47dfb476d3..79094fb7f3 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -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; } } -- 2.23.0

On Sat, 26 Oct 2019 at 15:17, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
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
arch/sandbox/cpu/os.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Sat, 26 Oct 2019 at 15:17, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
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
arch/sandbox/cpu/os.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot-dm, thanks!

On Sat, 26 Oct 2019 at 15:17, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
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
arch/sandbox/cpu/os.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot-dm, thanks! Applied to u-boot-dm, thanks!

On Sat, 26 Oct 2019 at 15:17, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
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
arch/sandbox/cpu/os.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot-dm, thanks! Applied to u-boot-dm, thanks! Applied to u-boot-dm, thanks!
participants (3)
-
Heinrich Schuchardt
-
Simon Glass
-
sjg@google.com