lkml.org 
[lkml]   [2016]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/1] mtd: ubi: fix improper return value
From
Date
On 04.12.2016 21:33, Joe Perches wrote:
>>> diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
> []
>>> @@ -1413,7 +1413,7 @@ int ubi_self_check_all_ff(struct ubi_device *ubi, int pnum, int offset, int len)
>>> buf = __vmalloc(len, GFP_NOFS, PAGE_KERNEL);
>>> if (!buf) {
>>> ubi_err(ubi, "cannot allocate memory to check for 0xFFs");
>>> - return 0;
>>> + return -ENOMEM;
>>
>> I wonder if you shouldn't also nuke the ubi_err() , because when you run
>> out of memory, printk() will likely also fail.
>
> No, not really. printk doesn't allocate memory.
>
> But the ubi_err should be removed because all memory
> allocations that fail without a specific GFP_NOWARN
> flag already have a dump_stack() call.

We should better think about how to get ubi_self_check_all_ff() fixed.
When enabled on a modern NAND, vmalloc() is likely to fail now and then
since len is the erase block size and can be up to a few mega bytes.

Thanks,
//richard

\
 
 \ /
  Last update: 2016-12-04 21:52    [W:0.075 / U:4.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site