[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 3/3] x86: Let extend_brk return a NULL pointer instead of just BUG_ON.



The callers of this function (dmi_alloc) and the various
Xen related ones can deal with a NULL pointer.

Suggested-by: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
 arch/x86/kernel/setup.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 16be6dc..13d6c51 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -268,9 +268,10 @@ void * __init extend_brk(size_t size, size_t align)
        BUG_ON(_brk_start == 0);
        BUG_ON(align & mask);
 
-       _brk_end = (_brk_end + mask) & ~mask;
-       BUG_ON((char *)(_brk_end + size) > __brk_limit);
+       if ((char *)(((_brk_end + mask) & ~mask) + size) > __brk_limit)
+               return NULL;
 
+       _brk_end = (_brk_end + mask) & ~mask;
        ret = (void *)_brk_end;
        _brk_end += size;
 
-- 
1.7.7.6


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.