about summary refs log tree commit diff stats
path: root/miasm2/jitter/vm_mngr.c
diff options
context:
space:
mode:
authorAymeric Vincent <aymeric.vincent@cea.fr>2016-08-01 14:24:21 +0200
committerAymeric Vincent <aymeric.vincent@cea.fr>2016-08-01 14:24:21 +0200
commit935f747ee92db8a89186244d2bb868e0e40c78cf (patch)
tree3f6a87bbf0e174af6ceafb6ca31328ca420fdf31 /miasm2/jitter/vm_mngr.c
parente42eb7f3f9cf8d7cbb9562dc8108815095e0cdc5 (diff)
downloadmiasm-935f747ee92db8a89186244d2bb868e0e40c78cf.tar.gz
miasm-935f747ee92db8a89186244d2bb868e0e40c78cf.zip
Fix get_memory_page_from_address()
This way we can fix the fix of find_page_node() by removing it altogether
Diffstat (limited to 'miasm2/jitter/vm_mngr.c')
-rw-r--r--miasm2/jitter/vm_mngr.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/miasm2/jitter/vm_mngr.c b/miasm2/jitter/vm_mngr.c
index 1d3dd891..f9d19b9d 100644
--- a/miasm2/jitter/vm_mngr.c
+++ b/miasm2/jitter/vm_mngr.c
@@ -119,9 +119,6 @@ inline int midpoint(int imin, int imax)
 
 int find_page_node(struct memory_page_node * array, uint64_t key, int imin, int imax)
 {
-	if (imax < 1)
-		return -1;
-	imax--;
 	// continue searching while [imin,imax] is not empty
 	while (imin <= imax) {
 		// calculate the midpoint for roughly equal partition
@@ -149,7 +146,7 @@ struct memory_page_node * get_memory_page_from_address(vm_mngr_t* vm_mngr, uint6
 	i = find_page_node(vm_mngr->memory_pages_array,
 			   ad,
 			   0,
-			   vm_mngr->memory_pages_number);
+			   vm_mngr->memory_pages_number - 1);
 	if (i >= 0) {
 		mpn = &vm_mngr->memory_pages_array[i];
 		if ((mpn->ad <= ad) && (ad < mpn->ad + mpn->size))