lkml.org 
[lkml]   [2004]   [Aug]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subjectswsusp error: do not oops after allocation failure
    Hi!

    This checks error return from swsusp_alloc, preventing oops when
    memory can not be allocated. Please apply,
    Pavel

    --- clean-mm.middle/kernel/power/swsusp.c 2004-08-20 14:11:31.000000000 +0200
    +++ linux-mm/kernel/power/swsusp.c 2004-08-28 23:18:52.000000000 +0200
    @@ -677,9 +677,9 @@
    calc_order();
    pagedir_save = (suspend_pagedir_t *)__get_free_pages(GFP_ATOMIC | __GFP_COLD,
    pagedir_order);
    - if(!pagedir_save)
    + if (!pagedir_save)
    return -ENOMEM;
    - memset(pagedir_save,0,(1 << pagedir_order) * PAGE_SIZE);
    + memset(pagedir_save, 0, (1 << pagedir_order) * PAGE_SIZE);
    pagedir_nosave = pagedir_save;
    return 0;
    }
    @@ -784,6 +784,7 @@
    int suspend_prepare_image(void)
    {
    unsigned int nr_needed_pages = 0;
    + int error;

    pr_debug("swsusp: critical section: \n");
    if (save_highmem()) {
    @@ -796,7 +797,9 @@
    printk("swsusp: Need to copy %u pages\n",nr_copy_pages);
    nr_needed_pages = nr_copy_pages + PAGES_FOR_IO;

    - swsusp_alloc();
    + error = swsusp_alloc();
    + if (error)
    + return error;

    /* During allocating of suspend pagedir, new cold pages may appear.
    * Kill them.
    --
    People were complaining that M$ turns users into beta-testers...
    ...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 14:05    [W:0.022 / U:0.264 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site