j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
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@ilande.co.uk Reviewed-by: Olivier Danet odanet@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();