[Crash-utility] [PATCH] crash: fix the bug about the command kmem

Wen Congyang wency at cn.fujitsu.com
Mon Jul 21 09:02:53 UTC 2008


Hi
 When I use kmem command on an IA64 box with RHEL5.2 as following,
 there are some errors.

crash> kmem -P e000000076c00000
Segmentation fault

The issue is that dump_mem_map() shouldn't be called when the address is a bad address.

Signed-off-by: Wen Congyang <wency at cn.fujitsu.com>

---
 memory.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/memory.c b/memory.c
index 912df04..f892391 100755
--- a/memory.c
+++ b/memory.c
@@ -10379,7 +10379,11 @@ kmem_search(struct meminfo *mi)
 mem_map:
 	mi->flags = orig_flags;
 	pc->curcmd_flags &= ~HEADER_PRINTED;
-        dump_mem_map(mi);
+	if (vaddr != BADADDR) {
+	        dump_mem_map(mi);
+	} else {
+		mi->retval = FALSE;
+	}
 
 	if (!mi->retval)
 		fprintf(fp, "%llx: %s address not found in mem map\n", 
-- 
1.5.3





More information about the Crash-utility mailing list