lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1e30aaca-b4a8-4269-c368-d1f6e0ffff54@ghiti.fr>
Date:   Fri, 12 May 2023 10:56:23 +0200
From:   Alexandre Ghiti <alex@...ti.fr>
To:     Linus Walleij <linus.walleij@...aro.org>,
        Geert Uytterhoeven <geert@...ux-m68k.org>,
        Vineet Gupta <vgupta@...nel.org>,
        Catalin Marinas <catalin.marinas@....com>,
        Will Deacon <will@...nel.org>, Arnd Bergmann <arnd@...db.de>,
        Russell King <linux@...linux.org.uk>,
        Greg Ungerer <gerg@...ux-m68k.org>
Cc:     linux-kernel@...r.kernel.org, linux-m68k@...ts.linux-m68k.org,
        linux-snps-arc@...ts.infradead.org, linux-fsdevel@...r.kernel.org,
        linux-cifs@...r.kernel.org, samba-technical@...ts.samba.org,
        linux-arm-kernel@...ts.infradead.org, linux-arch@...r.kernel.org,
        "linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>
Subject: Re: [PATCH 04/12] riscv: mm: init: Pass a pointer to virt_to_page()

+cc linux-riscv

On 5/11/23 13:59, Linus Walleij wrote:
> Functions that work on a pointer to virtual memory such as
> virt_to_pfn() and users of that function such as
> virt_to_page() are supposed to pass a pointer to virtual
> memory, ideally a (void *) or other pointer. However since
> many architectures implement virt_to_pfn() as a macro,
> this function becomes polymorphic and accepts both a
> (unsigned long) and a (void *).
>
> Fix this in the RISCV mm init code, so we can implement
> a strongly typed virt_to_pfn().
>
> Signed-off-by: Linus Walleij <linus.walleij@...aro.org>
> ---
>   arch/riscv/mm/init.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index 747e5b1ef02d..2f7a7c345a6a 100644
> --- a/arch/riscv/mm/init.c
> +++ b/arch/riscv/mm/init.c
> @@ -356,7 +356,7 @@ static phys_addr_t __init alloc_pte_late(uintptr_t va)
>   	unsigned long vaddr;
>   
>   	vaddr = __get_free_page(GFP_KERNEL);
> -	BUG_ON(!vaddr || !pgtable_pte_page_ctor(virt_to_page(vaddr)));
> +	BUG_ON(!vaddr || !pgtable_pte_page_ctor(virt_to_page((void *)vaddr)));
>   
>   	return __pa(vaddr);
>   }
> @@ -439,7 +439,7 @@ static phys_addr_t __init alloc_pmd_late(uintptr_t va)
>   	unsigned long vaddr;
>   
>   	vaddr = __get_free_page(GFP_KERNEL);
> -	BUG_ON(!vaddr || !pgtable_pmd_page_ctor(virt_to_page(vaddr)));
> +	BUG_ON(!vaddr || !pgtable_pmd_page_ctor(virt_to_page((void *)vaddr)));
>   
>   	return __pa(vaddr);
>   }
>

Reviewed-by: Alexandre Ghiti <alexghiti@...osinc.com>

Thanks,

Alex

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ