[OpenBIOS] [commit] r1339 - trunk/openbios-devel/libopenbios

repository service svn at openbios.org
Wed May 13 01:04:20 CEST 2015


Author: mcayland
Date: Wed May 13 01:04:20 2015
New Revision: 1339
URL: http://tracker.coreboot.org/trac/openbios/changeset/1339

Log:
OFMEM: fix off-by-one calculation in available property tail calculation

Make sure that the final address of the range is passed into
ofmem_update_memory_available() for physical ranges, rather than the
physical memory size. This enables us to fix an off-by-one calculation
in the tail entry for the available property.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
Reviewed-by: Olivier Danet <odanet at caramail.com>

Modified:
   trunk/openbios-devel/libopenbios/ofmem_common.c

Modified: trunk/openbios-devel/libopenbios/ofmem_common.c
==============================================================================
--- trunk/openbios-devel/libopenbios/ofmem_common.c	Wed May 13 01:04:17 2015	(r1338)
+++ trunk/openbios-devel/libopenbios/ofmem_common.c	Wed May 13 01:04:20 2015	(r1339)
@@ -334,8 +334,8 @@
 	}
 
 	/* tail */
-	if (start < top_address) {
-		ofmem_arch_create_available_entry(ph, &prop[ncells], start, top_address - start);
+	if ((start - 1) < top_address) {
+		ofmem_arch_create_available_entry(ph, &prop[ncells], start, top_address - start + 1);
 		ncells += ofmem_arch_get_available_entry_size(ph);
 	}
 
@@ -348,7 +348,7 @@
 	ofmem_t *ofmem = ofmem_arch_get_private();
 
 	ofmem_update_memory_available(s_phandle_memory, ofmem->phys_range, 
-			&phys_range_prop, &phys_range_prop_size, &phys_range_prop_used, get_ram_size());
+			&phys_range_prop, &phys_range_prop_size, &phys_range_prop_used, get_ram_size() - 1);
 	ofmem_update_memory_available(s_phandle_mmu, ofmem->virt_range, 
 			&virt_range_prop, &virt_range_prop_size, &virt_range_prop_used, (ucell)-1);
 	ofmem_update_mmu_translations();



More information about the OpenBIOS mailing list