lkml.org 
[lkml]   [2012]   [Jul]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3/3] x86: Let extend_brk return a NULL pointer instead of just BUG_ON.
    Date
    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@citrix.com>
    Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    ---
    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


    \
     
     \ /
      Last update: 2012-07-31 13:41    [W:2.645 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site