[Crash-utility] [PATCH] s390dbf: Fix reading of 64 bit pointers

Michael Holzheu holzheu at linux.vnet.ibm.com
Tue Sep 28 12:13:48 UTC 2010


Hello Dave,

Currently the s390dbf command uses KL_UINT() for reading pointers. This
works only if the pointers are below 4 GiB. To fix this issue I now use
a new KL_ULONG() function for reading pointers correctly.

Michael
---
 s390dbf.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

--- a/s390dbf.c
+++ b/s390dbf.c
@@ -139,9 +139,10 @@ static inline void* K_PTR(void* addr, ch
 	return addr+MEMBER_OFFSET(struct_name,member_name);
 }
 
-static inline uint32_t KL_UINT(void* ptr, char* struct_name, char* member_name)
+static inline unsigned long KL_ULONG(void* ptr, char* struct_name, char*
+				     member_name)
 {
-	return (uint32_t) ULONG(ptr+MEMBER_OFFSET(struct_name,member_name));
+	return ULONG(ptr+MEMBER_OFFSET(struct_name,member_name));
 }
 
 static inline uint32_t KL_VREAD_UINT32(kaddr_t addr)
@@ -900,7 +901,7 @@ debug_get_areas_v1(debug_info_t* db_info
 	area_size = PAGE_SIZE << db_info->page_order;
        	db_info->areas = (void**)malloc(db_info->nr_areas * sizeof(void *));
 	memset(db_info->areas, 0, db_info->nr_areas * sizeof(void *));
-       	mem_pos = (kaddr_t) KL_UINT(k_dbi,"debug_info","areas");
+       	mem_pos = KL_ULONG(k_dbi,"debug_info","areas");
        	for (i = 0; i < db_info->nr_areas; i++) {
 		dbe_addr = KL_VREAD_PTR(mem_pos);
 	       	db_info->areas[i] = (debug_entry_t *) malloc(area_size);
@@ -918,7 +919,7 @@ debug_get_areas_v2(debug_info_t* db_info
 	kaddr_t page_ptr;
 	int i,j;
        	db_info->areas_v2=(void***)malloc(db_info->nr_areas * sizeof(void **));
-       	area_ptr = (kaddr_t) KL_UINT(k_dbi,"debug_info","areas");
+       	area_ptr = KL_ULONG(k_dbi,"debug_info","areas");
        	for (i = 0; i < db_info->nr_areas; i++) {
 		db_info->areas_v2[i] = (void**)malloc(db_info->pages_per_area_v2
 							* sizeof(void*));
@@ -970,8 +971,8 @@ get_debug_info(kaddr_t addr,int get_area
 	db_info->page_order       = KL_INT(k_dbi,"debug_info","page_order");
 	db_info->buf_size	 = KL_INT(k_dbi,"debug_info","buf_size");
 	db_info->entry_size       = KL_INT(k_dbi,"debug_info","entry_size");
-	db_info->next_dbi	 = KL_UINT(k_dbi,"debug_info","next");
-	db_info->prev_dbi	 = KL_UINT(k_dbi,"debug_info","prev");
+	db_info->next_dbi	 = KL_ULONG(k_dbi,"debug_info","next");
+	db_info->prev_dbi	 = KL_ULONG(k_dbi,"debug_info","prev");
 	db_info->addr	     = addr;
 	strncpy(db_info->name,K_PTR(k_dbi,"debug_info","name"),
 		DEBUG_MAX_PROCF_LEN);

-------------- next part --------------
A non-text attachment was scrubbed...
Name: crash-5.0.7-s390dbf-long.patch
Type: text/x-patch
Size: 2423 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20100928/cd7eefcf/attachment.bin>


More information about the Crash-utility mailing list