lkml.org 
[lkml]   [2017]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [Part1 PATCH v4 10/17] x86/mm, resource: Use PAGE_KERNEL protection for ioremap of memory pages
From
Date


On 09/17/2017 09:07 AM, Borislav Petkov wrote:

...

>> -static int __ioremap_check_ram(unsigned long start_pfn, unsigned long nr_pages,
>> - void *arg)
>> +static int __ioremap_check_ram(struct resource *res)
>> {
>> + unsigned long start_pfn, stop_pfn;
>> unsigned long i;
>>
>> - for (i = 0; i < nr_pages; ++i)
>> - if (pfn_valid(start_pfn + i) &&
>> - !PageReserved(pfn_to_page(start_pfn + i)))
>> - return 1;
>> + if ((res->flags & IORESOURCE_SYSTEM_RAM) != IORESOURCE_SYSTEM_RAM)
>> + return 0;
>> +
>> + start_pfn = (res->start + PAGE_SIZE - 1) >> PAGE_SHIFT;
>> + stop_pfn = (res->end + 1) >> PAGE_SHIFT;
>> + if (stop_pfn > start_pfn) {
>> + for (i = 0; i < (stop_pfn - start_pfn); ++i)
>> + if (pfn_valid(start_pfn + i) &&
>> + !PageReserved(pfn_to_page(start_pfn + i)))
>> + return 1;
>> + }
>>
>> return 0;
>
> Should return bool I guess.
>

Yes, I will fix it in next rev. thanks

thanks

\
 
 \ /
  Last update: 2017-09-26 21:14    [W:0.060 / U:20.020 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site