Is high_memory check in omap2.c for OneNAND is sufficient?

Singh, Vimal vimalsingh at
Thu Mar 26 04:42:38 EDT 2009

From: Adrian Hunter [adrian.hunter at]
>Singh, Vimal wrote:
>> From: Adrian Hunter [adrian.hunter at]
>>> Singh, Vimal wrote:
>>>> From: Adrian Hunter [adrian.hunter at]
>>>>> Singh, Vimal wrote:
>>>>>> There is check for 'high_memory' in 'drivers/mtd/onenand/omap2.c', always before doing 'dma_map_single'.
>>>>>> Snippet:
>>>>>> ----------------------
>>>>>>         if (buf >= high_memory) {
>>>>>>                 struct page *p1;
>>>>>> ----------------------
>>>>>> This check seems not sufficient. There should be a check for upper boundary too.
>>>>>> Thinking scenario when 'buf' is less than 'high_memory', but somewhere near to it, and 'count' is big enough to beyond 'high_memory'.
>>>>> AFAIK it is not possible to allocate memory that crosses the high_memory boundary.
>>>> Do you mean 'buf' can not cross 'high_memory' boundary?
>>> Yes.
>> If so, then I wonder why above check is present in code...
>Which check?

I mean, if 'buf' can cross 'high_memory' boundary then why do we nedd "if (buf >= high_memory)" check and re-manipulating 'buf' in code (in drivers/mtd/onenand/omap2.c).

I am really confuse now... when this particular condition will occur.

>>>> But then I have seen a case where it was crossing that and BUG was reported by function 'dma_cache_maint'.
>>> Is it possible that 'buf' or 'count' is wrong?
>> I do not think so...

More information about the linux-mtd mailing list