Subject: Re: [PATCH 3/3] powerpc/mm: Use VMALLOC_START to validate addr

From: "Aneesh Kumar K.V" <[email-masked]>
Date: Mon, 27 Jun 2022 10:14:37 +0530

Michael Ellerman <[email-masked]> writes:

> "Aneesh Kumar K.V" <[email-masked]> writes:
>> Instead of high_memory use VMALLOC_START to validate that the address is
>> not in the vmalloc range.
>>
>> Cc: Kefeng Wang <[email-masked]>
>> Cc: Christophe Leroy <[email-masked]>
>> Signed-off-by: Aneesh Kumar K.V <[email-masked]>
>
> Isn't this really the fix for ffa0b64e3be5 ("powerpc: Fix
> virt_addr_valid() for 64-bit Book3E & 32-bit") ?

If we are looking for a simpler backport yet. But what commit ffa0b64e3be5 
does is correct. high_memory is suppose to be the top of direct mapped
address range. Hence checking for high_meory will also avoid vmalloc address.

If we take patch 1 then patch 3 is not really a fix. I would consider it
a cleanup to switch to a more familiar VMALLOC_START variable.

>
> cheers
>
>> diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
>> index e5f75c70eda8..256cad69e42e 100644
>> --- a/arch/powerpc/include/asm/page.h
>> +++ b/arch/powerpc/include/asm/page.h
>> @@ -134,7 +134,7 @@ static inline bool pfn_valid(unsigned long pfn)
>>  
>>  #define virt_addr_valid(vaddr)	({					\
>>  	unsigned long _addr = (unsigned long)vaddr;			\
>> -	_addr >= PAGE_OFFSET && _addr < (unsigned long)high_memory &&	\
>> +	_addr >= PAGE_OFFSET && _addr < (unsigned long)VMALLOC_START &&	\
>>  	pfn_valid(virt_to_pfn(_addr));					\
>>  })
>>  
>> -- 
>> 2.36.1