Fix these warnings with -m32 (e.g. ARM) builds on 64-bit.  Without the
fix, gcore.so sometimes segfaults due to overwriting of stack variables.

 libgcore/gcore_coredump.c: In function ‘gcore_readmem_user’:
 libgcore/gcore_coredump.c:85:26: warning: passing argument 2 of
 ‘uvtop_quiet’ from incompatible pointer type
 [-Wincompatible-pointer-types]

    if (!uvtop_quiet(addr, &paddr)) {
                           ^~~~~~
 libgcore/gcore_coredump.c:71:49: note: expected ‘physaddr_t *’ {aka
 ‘long long unsigned int *’} but argument is of type ‘ulong *’ {aka ‘long
 unsigned int *’}

  static int uvtop_quiet(ulong vaddr, physaddr_t *paddr);
                                      ~~~~~~~~~~~~^~~~~

Signed-off-by: Vincent Whitchurch <[email protected]>
---
 src/libgcore/gcore_coredump.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/libgcore/gcore_coredump.c b/src/libgcore/gcore_coredump.c
index c14cc11..424b0a4 100644
--- a/src/libgcore/gcore_coredump.c
+++ b/src/libgcore/gcore_coredump.c
@@ -78,7 +78,8 @@ readswap(ulonglong pte_val, char *buf, ulong len, ulonglong 
vaddr)
 
 void gcore_readmem_user(ulong addr, void *buf, long size, char *type)
 {
-       ulong paddr, cnt;
+       physaddr_t paddr;
+       ulong cnt;
        char *bufptr = buf;
 
        while (size > 0) {
-- 
2.28.0

--
Crash-utility mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/crash-utility
Contribution Guidelines: https://github.com/crash-utility/crash/wiki

Reply via email to