Re: [PATCH v3 02/12] m68k: Pass a pointer to virt_to_pfn() virt_to_page()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Linus,

On Tue, May 23, 2023 at 4:05 PM Linus Walleij <linus.walleij@xxxxxxxxxx> 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.

The page table include <asm/pgtable.h> will include different
variants of the defines depending on whether you build for
classic m68k, ColdFire or Sun3, so fix all variants.

Tested-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>

Thanks for your patch!

---
ChangeLog v2->v3:
- Fix up versioning. This is v3.
- Let Coldfire __pte_page() return a (void *) instead of __va
- Delete Coldfire pte_pagenr() which was using unsigned long
  semantics from __pte_page()

You may want to mention this removal in the patch descriptin.

- Drop ill-advised change to Coldfire pmd_page_vaddr()

--- a/arch/m68k/include/asm/sun3_pgtable.h
+++ b/arch/m68k/include/asm/sun3_pgtable.h

@@ -111,7 +111,7 @@ static inline void pte_clear (struct mm_struct *mm, unsigned long addr, pte_t *p

 #define pte_page(pte)          virt_to_page(__pte_page(pte))
 #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))

There's an extra space between "void" and "*".

Reviewed-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Acked-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

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



[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux