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: <CAMuHMdV5Aukxx+XyC-s2=CDa2BYqvc3uRvWBhD6ri5j09tXj3A@mail.gmail.com>
Date:   Fri, 12 May 2023 12:26:14 +0200
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Linus Walleij <linus.walleij@...aro.org>
Cc:     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>,
        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
Subject: Re: [PATCH 02/12] m68k: Pass a pointer to virt_to_pfn() virt_to_page()

On Fri, May 12, 2023 at 11:55 AM Geert Uytterhoeven
<geert@...ux-m68k.org> wrote:
> On Thu, May 11, 2023 at 1:59 PM Linus Walleij <linus.walleij@...aro.org> 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 up the offending calls in arch/m68k with explicit casts.
> >
> > Signed-off-by: Linus Walleij <linus.walleij@...aro.org>
> > ---
> > ChangeLog v1->v2:
> > - Add an extra parens around the page argument to the
> >   PD_PTABLE() macro, as is normally required.
>
> Thanks for the update!
>
> To build sun3_defconfig and m5475evb_defconfig cleanly, you need to
> include the (Gmail-whitespace-damaged) changes below.
> These were compile-tested only.

> --- a/arch/m68k/include/asm/sun3_pgtable.h
> +++ b/arch/m68k/include/asm/sun3_pgtable.h
> @@ -109,9 +109,9 @@ static inline void pte_clear (struct mm_struct
> *mm, unsigned long addr, pte_t *p
>  #define pfn_pte(pfn, pgprot) \
>  ({ pte_t __pte; pte_val(__pte) = pfn | pgprot_val(pgprot); __pte; })
>
> -#define pte_page(pte)          virt_to_page(__pte_page(pte))
> +#define pte_page(pte)          virt_to_page((void *)__pte_page(pte))

Much simpler to drop the cast in __pte_page() instead:

@@ -91,7 +91,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
 #define pmd_set(pmdp,ptep) do {} while (0)

 #define __pte_page(pte) \
-((unsigned long) __va ((pte_val (pte) & SUN3_PAGE_PGNUM_MASK) << PAGE_SHIFT))
+        (__va ((pte_val (pte) & SUN3_PAGE_PGNUM_MASK) << PAGE_SHIFT))

 static inline unsigned long pmd_page_vaddr(pmd_t pmd)
 {

>  #define pmd_pfn(pmd)           (pmd_val(pmd) >> PAGE_SHIFT)
> -#define pmd_page(pmd)          virt_to_page(pmd_page_vaddr(pmd))
> +#define pmd_page(pmd)          virt_to_page((void *)pmd_page_vaddr(pmd))

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ