summaryrefslogtreecommitdiffstats
path: root/src/lib/stdlib.C
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2011-06-09 14:24:10 -0500
committerNicholas E. Bofferding <bofferdn@us.ibm.com>2011-06-09 14:36:18 -0500
commitcc936a97df69d3936341e7e6642d445aad13a703 (patch)
tree0a99d0fa2c5e5d28e49caf993d3b46d40e4c4fc8 /src/lib/stdlib.C
parent63657a69627ca1dbd10fb683a8096ab2e8e77f2b (diff)
downloadtalos-hostboot-cc936a97df69d3936341e7e6642d445aad13a703.tar.gz
talos-hostboot-cc936a97df69d3936341e7e6642d445aad13a703.zip
Fix page rounding issue in malloc.
Change-Id: I22c7d2b7c4d9d77b235efd6a3e0ff9280ac8a854 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/143 Tested-by: Jenkins Server Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Diffstat (limited to 'src/lib/stdlib.C')
-rw-r--r--src/lib/stdlib.C3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/stdlib.C b/src/lib/stdlib.C
index 1614bdd8f..ab509ca9a 100644
--- a/src/lib/stdlib.C
+++ b/src/lib/stdlib.C
@@ -7,7 +7,8 @@ void* malloc(size_t s)
{
if (s > HeapManager::MAX_ALLOC_SIZE)
{
- size_t pages = (s+8) / PageManager::PAGESIZE;
+ size_t pages = (s + 8 + (PageManager::PAGESIZE - 1))
+ / PageManager::PAGESIZE;
void* v = PageManager::allocatePage(pages);
size_t* len = (size_t*)v;
*len = pages << 8;
OpenPOWER on IntegriCloud