All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sh: pgtable-3level: Fix cast to pointer from integer of different size
@ 2021-09-15 13:50 Geert Uytterhoeven
  2021-09-15 13:58   ` Daniel Palmer
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Geert Uytterhoeven @ 2021-09-15 13:50 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Aneesh Kumar K . V, Andrew Morton
  Cc: Jacopo Mondi, Daniel Palmer, linux-sh, linux-mm, linux-kernel,
	Geert Uytterhoeven

If X2TLB=y (CPU_SHX2=y or CPU_SHX3=y, e.g. migor_defconfig), pgd_t.pgd
is "unsigned long long", causing:

    In file included from arch/sh/include/asm/pgtable.h:13,
		     from include/linux/pgtable.h:6,
		     from include/linux/mm.h:33,
		     from arch/sh/kernel/asm-offsets.c:14:
    arch/sh/include/asm/pgtable-3level.h: In function ‘pud_pgtable’:
    arch/sh/include/asm/pgtable-3level.h:37:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
       37 |  return (pmd_t *)pud_val(pud);
	  |         ^

Fix this by adding an intermediate cast to "unsigned long", which is
basically what the old code did before.

Fixes: 9cf6fa2458443118 ("mm: rename pud_page_vaddr to pud_pgtable and make it return pmd_t *")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Compile-tested only, as the remote Migo-R is MIA.
Anyone with e.g. a Migo-R or Ecovec to boot-test?
The truncation to "unsigned long" has been there since forever, so
probably it still works fine ;-)

... once the other build issues are fixed.
---
 arch/sh/include/asm/pgtable-3level.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sh/include/asm/pgtable-3level.h b/arch/sh/include/asm/pgtable-3level.h
index 56bf35c2f29c2b83..cdced80a7ffa3944 100644
--- a/arch/sh/include/asm/pgtable-3level.h
+++ b/arch/sh/include/asm/pgtable-3level.h
@@ -34,7 +34,7 @@ typedef struct { unsigned long long pmd; } pmd_t;
 
 static inline pmd_t *pud_pgtable(pud_t pud)
 {
-	return (pmd_t *)pud_val(pud);
+	return (pmd_t *)(unsigned long)pud_val(pud);
 }
 
 /* only used by the stubbed out hugetlb gup code, should never be called */
-- 
2.25.1


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

end of thread, other threads:[~2021-09-23 15:20 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-15 13:50 [PATCH] sh: pgtable-3level: Fix cast to pointer from integer of different size Geert Uytterhoeven
2021-09-15 13:58 ` Daniel Palmer
2021-09-15 13:58   ` Daniel Palmer
2021-09-16 12:06 ` Daniel Palmer
2021-09-16 12:06   ` Daniel Palmer
2021-09-17  1:32 ` Rob Landley
2021-09-17  9:21   ` Geert Uytterhoeven
2021-09-17  9:21     ` Geert Uytterhoeven
2021-09-18  5:04     ` Rob Landley
2021-09-18 11:20       ` Geert Uytterhoeven
2021-09-18 11:20         ` Geert Uytterhoeven
2021-09-23 15:20 ` John Paul Adrian Glaubitz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.