2024-05-27 05:03:18

by Oscar Salvador

[permalink] [raw]
Subject: Re: [RFC PATCH v3 05/16] powerpc/mm: Fix __find_linux_pte() on 32 bits with PMD leaf entries

On Sun, May 26, 2024 at 11:22:25AM +0200, Christophe Leroy wrote:
> Building on 32 bits with pmd_leaf() not returning always false leads
> to the following error:
>
> CC arch/powerpc/mm/pgtable.o
> arch/powerpc/mm/pgtable.c: In function '__find_linux_pte':
> arch/powerpc/mm/pgtable.c:506:1: error: function may return address of local variable [-Werror=return-local-addr]
> 506 | }
> | ^
> arch/powerpc/mm/pgtable.c:394:15: note: declared here
> 394 | pud_t pud, *pudp;
> | ^~~
> arch/powerpc/mm/pgtable.c:394:15: note: declared here
>
> This is due to pmd_offset() being a no-op in that case.
>
> So rework it for powerpc/32 so that pXd_offset() are used on real
> pointers and not on on-stack copies.
>
> Signed-off-by: Christophe Leroy <[email protected]>

Maybe this could be folded into the patch that makes pmd_leaf() not returning
always false, but no strong feelings:

Reviewed-by: Oscar Salvador <[email protected]>


--
Oscar Salvador
SUSE Labs


2024-05-27 05:17:16

by Christophe Leroy

[permalink] [raw]
Subject: Re: [RFC PATCH v3 05/16] powerpc/mm: Fix __find_linux_pte() on 32 bits with PMD leaf entries



Le 27/05/2024 à 06:55, Oscar Salvador a écrit :
> On Sun, May 26, 2024 at 11:22:25AM +0200, Christophe Leroy wrote:
>> Building on 32 bits with pmd_leaf() not returning always false leads
>> to the following error:
>>
>> CC arch/powerpc/mm/pgtable.o
>> arch/powerpc/mm/pgtable.c: In function '__find_linux_pte':
>> arch/powerpc/mm/pgtable.c:506:1: error: function may return address of local variable [-Werror=return-local-addr]
>> 506 | }
>> | ^
>> arch/powerpc/mm/pgtable.c:394:15: note: declared here
>> 394 | pud_t pud, *pudp;
>> | ^~~
>> arch/powerpc/mm/pgtable.c:394:15: note: declared here
>>
>> This is due to pmd_offset() being a no-op in that case.
>>
>> So rework it for powerpc/32 so that pXd_offset() are used on real
>> pointers and not on on-stack copies.
>>
>> Signed-off-by: Christophe Leroy <[email protected]>
>
> Maybe this could be folded into the patch that makes pmd_leaf() not returning
> always false, but no strong feelings:

I prefer to keep it separate, the patch introducing pmd_leaf() is
already big enough.

>
> Reviewed-by: Oscar Salvador <[email protected]>
>
>