ubiformat: libmt error (side effect from last Large Buffer Allocations patch)

Grant Erickson marathon96 at gmail.com
Tue Apr 26 11:44:38 EDT 2011


On 4/26/11 1:37 AM, Artem Bityutskiy wrote:
> On Tue, 2011-04-26 at 08:56 +0200, Stefano Babic wrote:
>> I have seen a side effect introduced with Grant's patch. I have applied
>> the patchset and this fix the allocation problem in kernel.
> 
> I think it would be great to actually CC grant :-) So, this e-mail is
> about this patch:
> 
> http://lists.infradead.org/pipermail/linux-mtd/2011-April/034818.html
> 
> Grant, the original e-mail from Stefano:
> http://lists.infradead.org/pipermail/linux-mtd/2011-April/035190.html
> 
>> However, the result lenght can be an odd multiple of the minimum I/O
>> size, and when there is not enough memory available, the introduced
>> mtd_malloc_up_to_size() tries to allocate half the amount of requested
>> size, getting a buffer not aligned with the minimum I/O size. The result
>> is that the test in nand_base.c for the alignment fails:
> 
> Good catch! Shame on me to not foresee this issue. Thanks for reporting!
> 
>> IMHO mtd_malloc_up_to_size() must allocate a buffer aligned with the
>> minimum I/O size. What about adding the I/O size as parameter to
>> mtd_malloc_up_to_size, so the function will return always an aligned
>> buffer ?
> 
> Yes, I think this is the right solution. I've cooked the following
> patch, compile-tested only - please review and test.
> 
> 
> From 18d93dac176025defd5711b429acd91ef8563a9a Mon Sep 17 00:00:00 2001
> From: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
> Date: Tue, 26 Apr 2011 11:42:10 +0300
> Subject: [PATCH] mtd: a fix candidate for mtd_kmalloc_up_to

Artem:

Thanks for adding me to the thread. Agree that the proposed patch seems like
a good solution.

Best,

Grant





More information about the linux-mtd mailing list