[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b7a8883c-a32d-82f0-f114-4a0f2b537c16@amd.com>
Date: Tue, 26 Sep 2017 14:11:42 -0500
From: Brijesh Singh <brijesh.singh@....com>
To: Borislav Petkov <bp@...e.de>
Cc: brijesh.singh@....com, linux-kernel@...r.kernel.org,
x86@...nel.org, kvm@...r.kernel.org,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H . Peter Anvin" <hpa@...or.com>,
Andy Lutomirski <luto@...nel.org>,
Tom Lendacky <thomas.lendacky@....com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Laura Abbott <labbott@...hat.com>,
Jérôme Glisse <jglisse@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Dan Williams <dan.j.williams@...el.com>,
Kees Cook <keescook@...omium.org>
Subject: Re: [Part1 PATCH v4 10/17] x86/mm, resource: Use PAGE_KERNEL
protection for ioremap of memory pages
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
Powered by blists - more mailing lists