Skip to content

Commit e7a9af8

Browse files
chleroympe
authored andcommitted
powerpc/mm: Fix size of allocated PGDIR
Commit 6b0e827 ("powerpc/e500: switch to 64 bits PGD on 85xx (32 bits)") increased the size of PGD entries but failed to increase the PGD directory. Use the size of pgd_t instead of the size of pointers to calculate the allocated size. Reported-by: Guenter Roeck <linux@roeck-us.net> Fixes: 6b0e827 ("powerpc/e500: switch to 64 bits PGD on 85xx (32 bits)") Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Tested-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/1cdaacb391cbd3e0240f0e0faf691202874e9422.1723109462.git.christophe.leroy@csgroup.eu
1 parent 06ce0af commit e7a9af8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/powerpc/mm/init-common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void setup_kup(void)
7373

7474
#define CTOR(shift) static void ctor_##shift(void *addr) \
7575
{ \
76-
memset(addr, 0, sizeof(void *) << (shift)); \
76+
memset(addr, 0, sizeof(pgd_t) << (shift)); \
7777
}
7878

7979
CTOR(0); CTOR(1); CTOR(2); CTOR(3); CTOR(4); CTOR(5); CTOR(6); CTOR(7);
@@ -117,7 +117,7 @@ EXPORT_SYMBOL_GPL(pgtable_cache); /* used by kvm_hv module */
117117
void pgtable_cache_add(unsigned int shift)
118118
{
119119
char *name;
120-
unsigned long table_size = sizeof(void *) << shift;
120+
unsigned long table_size = sizeof(pgd_t) << shift;
121121
unsigned long align = table_size;
122122

123123
/* When batching pgtable pointers for RCU freeing, we store

0 commit comments

Comments
 (0)