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

Reply via email to