2023-08-08 22:17:37

by Linus Walleij

[permalink] [raw]
Subject: [PATCH 0/2] csky: Convert memory accessors to static inlines

This converts the virt_to_pfn and pfn_to_virt macros
into static inlines so we get proper type checking on
the pointers passed in.

Signed-off-by: Linus Walleij <[email protected]>
---
Linus Walleij (2):
csky: Cast argument to virt_to_pfn() to (void *)
csky: Make pfn accessors static inlines

arch/arc/include/asm/page.h | 2 +-
arch/csky/include/asm/page.h | 13 ++++++++++---
2 files changed, 11 insertions(+), 4 deletions(-)
---
base-commit: 06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5
change-id: 20230808-csky-virt-to-phys-3d80c17211f9

Best regards,
--
Linus Walleij <[email protected]>



2023-08-08 22:37:14

by Linus Walleij

[permalink] [raw]
Subject: [PATCH 1/2] csky: Cast argument to virt_to_pfn() to (void *)

The virt_to_pfn() function takes a (void *) as argument, fix
this up to avoid exploiting the unintended polymorphism of
virt_to_pfn.

Signed-off-by: Linus Walleij <[email protected]>
---
arch/arc/include/asm/page.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arc/include/asm/page.h b/arch/arc/include/asm/page.h
index e43fe27ec54d..02b53ad811fb 100644
--- a/arch/arc/include/asm/page.h
+++ b/arch/arc/include/asm/page.h
@@ -108,7 +108,7 @@ extern int pfn_valid(unsigned long pfn);

#else /* CONFIG_HIGHMEM */

-#define ARCH_PFN_OFFSET virt_to_pfn(CONFIG_LINUX_RAM_BASE)
+#define ARCH_PFN_OFFSET virt_to_pfn((void *)CONFIG_LINUX_RAM_BASE)

#endif /* CONFIG_HIGHMEM */


--
2.34.1


2023-08-09 01:21:20

by Guo Ren

[permalink] [raw]
Subject: Re: [PATCH 0/2] csky: Convert memory accessors to static inlines

On Tue, Aug 8, 2023 at 4:26 PM Linus Walleij <[email protected]> wrote:
>
> This converts the virt_to_pfn and pfn_to_virt macros
> into static inlines so we get proper type checking on
> the pointers passed in.
>
> Signed-off-by: Linus Walleij <[email protected]>
> ---
> Linus Walleij (2):
> csky: Cast argument to virt_to_pfn() to (void *)
> csky: Make pfn accessors static inlines
>
> arch/arc/include/asm/page.h | 2 +-
> arch/csky/include/asm/page.h | 13 ++++++++++---
> 2 files changed, 11 insertions(+), 4 deletions(-)
> ---
> base-commit: 06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5
> change-id: 20230808-csky-virt-to-phys-3d80c17211f9
>
> Best regards,
> --
> Linus Walleij <[email protected]>
>
Thx, Approved.


--
Best Regards
Guo Ren