projects
/
polintos
/
scott
/
priv.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ed94ee9
)
Cause excessively large malloc()s to fail rather than assert.
author
Scott Wood
<scott@thor.buserror.net>
Mon, 12 May 2008 02:11:46 +0000
(21:11 -0500)
committer
Scott Wood
<scott@thor.buserror.net>
Mon, 12 May 2008 02:11:46 +0000
(21:11 -0500)
GCC's exception frame searching will malloc() larger than a page;
returning NULL forces it to fall back on slower, in-place searching.
Signed-off-by: Scott Wood <scott@thor.buserror.net>
kernel/lib/libc.cc
patch
|
blob
|
history
diff --git
a/kernel/lib/libc.cc
b/kernel/lib/libc.cc
index 6518988b7b2538fe3acb510fa711f608dfabc2ed..8d9685a5a309eebc23b27d4d0c1c38cd0983df9d 100644
(file)
--- a/
kernel/lib/libc.cc
+++ b/
kernel/lib/libc.cc
@@
-34,7
+34,8
@@
void bzero(void *b, size_t len)
void *malloc(size_t len)
{
- assert(len <= Arch::page_size - sizeof(size_t));
+ if (len > Arch::page_size - sizeof(size_t))
+ return NULL;
len = (len + sizeof(size_t) + Arch::page_size - 1) / Arch::page_size;
Mem::Page *page = Mem::PageAlloc::alloc(len);