diff mbox series

[1/5] lib/test_free_pages.c: Pass a pointer to virt_to_page()

Message ID 20220630084124.691207-2-linus.walleij@linaro.org (mailing list archive)
State New
Headers show
Series mm: Pass pointers to page accessors | expand

Commit Message

Linus Walleij June 30, 2022, 8:41 a.m. UTC
A pointer into virtual memory is represented by a (void *)
not an u32, so the compiler warns:

lib/test_free_pages.c:20:50: warning: passing argument 1
  of 'virt_to_pfn' makes pointer from integer without a
  cast [-Wint-conversion]

Fix this with an explicit cast.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 lib/test_free_pages.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/test_free_pages.c b/lib/test_free_pages.c
index 25ae1ac2624a..9ebf6f5549f3 100644
--- a/lib/test_free_pages.c
+++ b/lib/test_free_pages.c
@@ -17,7 +17,7 @@  static void test_free_pages(gfp_t gfp)
 
 	for (i = 0; i < 1000 * 1000; i++) {
 		unsigned long addr = __get_free_pages(gfp, 3);
-		struct page *page = virt_to_page(addr);
+		struct page *page = virt_to_page((void *)addr);
 
 		/* Simulate page cache getting a speculative reference */
 		get_page(page);