linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs/proc/kcore.c: Pass a pointer to virt_addr_valid()
@ 2022-08-29 13:13 Linus Walleij
  2022-08-29 15:18 ` Matthew Wilcox
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2022-08-29 13:13 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, Linus Walleij

The virt_addr_valid() should be passed a pointer, the current
code passing a long unsigned int is just exploiting the
unintentional polymorphism of these calls being implemented
as preprocessor macros.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 fs/proc/kcore.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index dff921f7ca33..f358960b7a1f 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -200,7 +200,7 @@ kclist_add_private(unsigned long pfn, unsigned long nr_pages, void *arg)
 	ent->addr = (unsigned long)page_to_virt(p);
 	ent->size = nr_pages << PAGE_SHIFT;
 
-	if (!virt_addr_valid(ent->addr))
+	if (!virt_addr_valid((void *)ent->addr))
 		goto free_out;
 
 	/* cut not-mapped area. ....from ppc-32 code. */
-- 
2.37.2



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fs/proc/kcore.c: Pass a pointer to virt_addr_valid()
  2022-08-29 13:13 [PATCH] fs/proc/kcore.c: Pass a pointer to virt_addr_valid() Linus Walleij
@ 2022-08-29 15:18 ` Matthew Wilcox
  2022-08-29 21:03   ` Linus Walleij
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox @ 2022-08-29 15:18 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Andrew Morton, linux-mm

On Mon, Aug 29, 2022 at 03:13:17PM +0200, Linus Walleij wrote:
> The virt_addr_valid() should be passed a pointer, the current
> code passing a long unsigned int is just exploiting the
> unintentional polymorphism of these calls being implemented
> as preprocessor macros.

Why do you think it's unintended polymorphism?  It looks to me
like polymorphism is absolutely intended.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fs/proc/kcore.c: Pass a pointer to virt_addr_valid()
  2022-08-29 15:18 ` Matthew Wilcox
@ 2022-08-29 21:03   ` Linus Walleij
  0 siblings, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2022-08-29 21:03 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: Andrew Morton, linux-mm

On Mon, Aug 29, 2022 at 5:18 PM Matthew Wilcox <willy@infradead.org> wrote:
> On Mon, Aug 29, 2022 at 03:13:17PM +0200, Linus Walleij wrote:

> > The virt_addr_valid() should be passed a pointer, the current
> > code passing a long unsigned int is just exploiting the
> > unintentional polymorphism of these calls being implemented
> > as preprocessor macros.
>
> Why do you think it's unintended polymorphism?  It looks to me
> like polymorphism is absolutely intended.

Intended, maybe.
Desired, no:
https://lore.kernel.org/linux-mm/20220701160004.2ffff4e5ab59a55499f4c736@linux-foundation.org/

Strong typing is nice.

Yours,
Linus Walleij


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-29 21:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-29 13:13 [PATCH] fs/proc/kcore.c: Pass a pointer to virt_addr_valid() Linus Walleij
2022-08-29 15:18 ` Matthew Wilcox
2022-08-29 21:03   ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox