linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 10679/10701] arch/x86/mm/pgtable.c:427:2: warning: variable length array 'u_pmds' is used
@ 2020-05-20 19:56 kbuild test robot
  2020-05-20 20:58 ` Randy Dunlap
  2020-05-20 23:11 ` Andrew Morton
  0 siblings, 2 replies; 5+ messages in thread
From: kbuild test robot @ 2020-05-20 19:56 UTC (permalink / raw)
  To: Mike Rapoport; +Cc: kbuild-all, Andrew Morton, Linux Memory Management List

[-- Attachment #1: Type: text/plain, Size: 4826 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   fb57b1fabcb28f358901b2df90abd2b48abc1ca8
commit: 0e19fc1c40bd7516d5a30a459db4f49d48910847 [10679/10701] mm: consolidate pgd_index() and pgd_offset{_k}() definitions
config: i386-randconfig-a005-20200520 (attached as .config)
compiler: gcc-4.9 (Ubuntu 4.9.3-13ubuntu2) 4.9.3
reproduce:
        git checkout 0e19fc1c40bd7516d5a30a459db4f49d48910847
        # save the attached .config to linux build tree
        make ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

arch/x86/mm/pgtable.c: In function 'pgd_alloc':
>> arch/x86/mm/pgtable.c:427:2: warning: variable length array 'u_pmds' is used [-Wvla]
pmd_t *u_pmds[MAX_PREALLOCATED_USER_PMDS];
^
>> arch/x86/mm/pgtable.c:428:2: warning: variable length array 'pmds' is used [-Wvla]
pmd_t *pmds[MAX_PREALLOCATED_PMDS];
^

vim +/u_pmds +427 arch/x86/mm/pgtable.c

1db491f77b6ed0 Fenghua Yu          2015-01-15  423  
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  424  pgd_t *pgd_alloc(struct mm_struct *mm)
1ec1fe73dfb711 Ingo Molnar         2008-03-19  425  {
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  426  	pgd_t *pgd;
184d47f0fd3651 Kees Cook           2018-10-08 @427  	pmd_t *u_pmds[MAX_PREALLOCATED_USER_PMDS];
184d47f0fd3651 Kees Cook           2018-10-08 @428  	pmd_t *pmds[MAX_PREALLOCATED_PMDS];
1ec1fe73dfb711 Ingo Molnar         2008-03-19  429  
1db491f77b6ed0 Fenghua Yu          2015-01-15  430  	pgd = _pgd_alloc();
1ec1fe73dfb711 Ingo Molnar         2008-03-19  431  
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  432  	if (pgd == NULL)
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  433  		goto out;
4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  434  
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  435  	mm->pgd = pgd;
4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  436  
f59dbe9ca6707e Joerg Roedel        2018-07-18  437  	if (preallocate_pmds(mm, pmds, PREALLOCATED_PMDS) != 0)
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  438  		goto out_free_pgd;
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  439  
f59dbe9ca6707e Joerg Roedel        2018-07-18  440  	if (preallocate_pmds(mm, u_pmds, PREALLOCATED_USER_PMDS) != 0)
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  441  		goto out_free_pmds;
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  442  
f59dbe9ca6707e Joerg Roedel        2018-07-18  443  	if (paravirt_pgd_alloc(mm) != 0)
f59dbe9ca6707e Joerg Roedel        2018-07-18  444  		goto out_free_user_pmds;
f59dbe9ca6707e Joerg Roedel        2018-07-18  445  
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  446  	/*
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  447  	 * Make sure that pre-populating the pmds is atomic with
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  448  	 * respect to anything walking the pgd_list, so that they
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  449  	 * never see a partially populated pgd.
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  450  	 */
a79e53d85683c6 Andrea Arcangeli    2011-02-16  451  	spin_lock(&pgd_lock);
4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  452  
617d34d9e5d832 Jeremy Fitzhardinge 2010-09-21  453  	pgd_ctor(mm, pgd);
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  454  	pgd_prepopulate_pmd(mm, pgd, pmds);
f59dbe9ca6707e Joerg Roedel        2018-07-18  455  	pgd_prepopulate_user_pmd(mm, pgd, u_pmds);
4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  456  
a79e53d85683c6 Andrea Arcangeli    2011-02-16  457  	spin_unlock(&pgd_lock);
4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  458  
4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  459  	return pgd;
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  460  
f59dbe9ca6707e Joerg Roedel        2018-07-18  461  out_free_user_pmds:
f59dbe9ca6707e Joerg Roedel        2018-07-18  462  	free_pmds(mm, u_pmds, PREALLOCATED_USER_PMDS);
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  463  out_free_pmds:
f59dbe9ca6707e Joerg Roedel        2018-07-18  464  	free_pmds(mm, pmds, PREALLOCATED_PMDS);
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  465  out_free_pgd:
1db491f77b6ed0 Fenghua Yu          2015-01-15  466  	_pgd_free(pgd);
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  467  out:
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  468  	return NULL;
4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  469  }
4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  470  

:::::: The code at line 427 was first introduced by commit
:::::: 184d47f0fd365108bd06ab26cdb3450b716269fd x86/mm: Avoid VLA in pgd_alloc()

:::::: TO: Kees Cook <keescook@chromium.org>
:::::: CC: Ingo Molnar <mingo@kernel.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 39201 bytes --]

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

* Re: [linux-next:master 10679/10701] arch/x86/mm/pgtable.c:427:2: warning: variable length array 'u_pmds' is used
  2020-05-20 19:56 [linux-next:master 10679/10701] arch/x86/mm/pgtable.c:427:2: warning: variable length array 'u_pmds' is used kbuild test robot
@ 2020-05-20 20:58 ` Randy Dunlap
  2020-05-20 23:11 ` Andrew Morton
  1 sibling, 0 replies; 5+ messages in thread
From: Randy Dunlap @ 2020-05-20 20:58 UTC (permalink / raw)
  To: kbuild test robot, Mike Rapoport
  Cc: kbuild-all, Andrew Morton, Linux Memory Management List

On 5/20/20 12:56 PM, kbuild test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   fb57b1fabcb28f358901b2df90abd2b48abc1ca8
> commit: 0e19fc1c40bd7516d5a30a459db4f49d48910847 [10679/10701] mm: consolidate pgd_index() and pgd_offset{_k}() definitions
> config: i386-randconfig-a005-20200520 (attached as .config)
> compiler: gcc-4.9 (Ubuntu 4.9.3-13ubuntu2) 4.9.3
> reproduce:
>         git checkout 0e19fc1c40bd7516d5a30a459db4f49d48910847
>         # save the attached .config to linux build tree
>         make ARCH=i386 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kbuild test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>, old ones prefixed by <<):
> 
> arch/x86/mm/pgtable.c: In function 'pgd_alloc':
>>> arch/x86/mm/pgtable.c:427:2: warning: variable length array 'u_pmds' is used [-Wvla]
> pmd_t *u_pmds[MAX_PREALLOCATED_USER_PMDS];
> ^
>>> arch/x86/mm/pgtable.c:428:2: warning: variable length array 'pmds' is used [-Wvla]
> pmd_t *pmds[MAX_PREALLOCATED_PMDS];
> ^
> 

Yes, I also reported this on linux-next of 20200518 (but I didn't copy Mike on it).


> vim +/u_pmds +427 arch/x86/mm/pgtable.c
> 
> 1db491f77b6ed0 Fenghua Yu          2015-01-15  423  
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  424  pgd_t *pgd_alloc(struct mm_struct *mm)
> 1ec1fe73dfb711 Ingo Molnar         2008-03-19  425  {
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  426  	pgd_t *pgd;
> 184d47f0fd3651 Kees Cook           2018-10-08 @427  	pmd_t *u_pmds[MAX_PREALLOCATED_USER_PMDS];
> 184d47f0fd3651 Kees Cook           2018-10-08 @428  	pmd_t *pmds[MAX_PREALLOCATED_PMDS];
> 1ec1fe73dfb711 Ingo Molnar         2008-03-19  429  
> 1db491f77b6ed0 Fenghua Yu          2015-01-15  430  	pgd = _pgd_alloc();
> 1ec1fe73dfb711 Ingo Molnar         2008-03-19  431  
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  432  	if (pgd == NULL)
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  433  		goto out;
> 4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  434  
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  435  	mm->pgd = pgd;
> 4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  436  
> f59dbe9ca6707e Joerg Roedel        2018-07-18  437  	if (preallocate_pmds(mm, pmds, PREALLOCATED_PMDS) != 0)
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  438  		goto out_free_pgd;
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  439  
> f59dbe9ca6707e Joerg Roedel        2018-07-18  440  	if (preallocate_pmds(mm, u_pmds, PREALLOCATED_USER_PMDS) != 0)
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  441  		goto out_free_pmds;
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  442  
> f59dbe9ca6707e Joerg Roedel        2018-07-18  443  	if (paravirt_pgd_alloc(mm) != 0)
> f59dbe9ca6707e Joerg Roedel        2018-07-18  444  		goto out_free_user_pmds;
> f59dbe9ca6707e Joerg Roedel        2018-07-18  445  
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  446  	/*
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  447  	 * Make sure that pre-populating the pmds is atomic with
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  448  	 * respect to anything walking the pgd_list, so that they
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  449  	 * never see a partially populated pgd.
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  450  	 */
> a79e53d85683c6 Andrea Arcangeli    2011-02-16  451  	spin_lock(&pgd_lock);
> 4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  452  
> 617d34d9e5d832 Jeremy Fitzhardinge 2010-09-21  453  	pgd_ctor(mm, pgd);
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  454  	pgd_prepopulate_pmd(mm, pgd, pmds);
> f59dbe9ca6707e Joerg Roedel        2018-07-18  455  	pgd_prepopulate_user_pmd(mm, pgd, u_pmds);
> 4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  456  
> a79e53d85683c6 Andrea Arcangeli    2011-02-16  457  	spin_unlock(&pgd_lock);
> 4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  458  
> 4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  459  	return pgd;
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  460  
> f59dbe9ca6707e Joerg Roedel        2018-07-18  461  out_free_user_pmds:
> f59dbe9ca6707e Joerg Roedel        2018-07-18  462  	free_pmds(mm, u_pmds, PREALLOCATED_USER_PMDS);
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  463  out_free_pmds:
> f59dbe9ca6707e Joerg Roedel        2018-07-18  464  	free_pmds(mm, pmds, PREALLOCATED_PMDS);
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  465  out_free_pgd:
> 1db491f77b6ed0 Fenghua Yu          2015-01-15  466  	_pgd_free(pgd);
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  467  out:
> d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  468  	return NULL;
> 4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  469  }
> 4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  470  
> 
> :::::: The code at line 427 was first introduced by commit
> :::::: 184d47f0fd365108bd06ab26cdb3450b716269fd x86/mm: Avoid VLA in pgd_alloc()
> 
> :::::: TO: Kees Cook <keescook@chromium.org>
> :::::: CC: Ingo Molnar <mingo@kernel.org>
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
> 


-- 
~Randy
Reported-by: Randy Dunlap <rdunlap@infradead.org>


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

* Re: [linux-next:master 10679/10701] arch/x86/mm/pgtable.c:427:2: warning: variable length array 'u_pmds' is used
  2020-05-20 19:56 [linux-next:master 10679/10701] arch/x86/mm/pgtable.c:427:2: warning: variable length array 'u_pmds' is used kbuild test robot
  2020-05-20 20:58 ` Randy Dunlap
@ 2020-05-20 23:11 ` Andrew Morton
  2020-05-20 23:50   ` Randy Dunlap
  2020-05-21  7:02   ` Mike Rapoport
  1 sibling, 2 replies; 5+ messages in thread
From: Andrew Morton @ 2020-05-20 23:11 UTC (permalink / raw)
  To: kbuild test robot
  Cc: Mike Rapoport, kbuild-all, Linux Memory Management List, Randy Dunlap

On Thu, 21 May 2020 03:56:53 +0800 kbuild test robot <lkp@intel.com> wrote:

> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   fb57b1fabcb28f358901b2df90abd2b48abc1ca8
> commit: 0e19fc1c40bd7516d5a30a459db4f49d48910847 [10679/10701] mm: consolidate pgd_index() and pgd_offset{_k}() definitions
> config: i386-randconfig-a005-20200520 (attached as .config)
> compiler: gcc-4.9 (Ubuntu 4.9.3-13ubuntu2) 4.9.3
> reproduce:
>         git checkout 0e19fc1c40bd7516d5a30a459db4f49d48910847
>         # save the attached .config to linux build tree
>         make ARCH=i386 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kbuild test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>, old ones prefixed by <<):
> 
> arch/x86/mm/pgtable.c: In function 'pgd_alloc':
> >> arch/x86/mm/pgtable.c:427:2: warning: variable length array 'u_pmds' is used [-Wvla]
> pmd_t *u_pmds[MAX_PREALLOCATED_USER_PMDS];
> ^
> >> arch/x86/mm/pgtable.c:428:2: warning: variable length array 'pmds' is used [-Wvla]
> pmd_t *pmds[MAX_PREALLOCATED_PMDS];
> ^

Thanks.  This works for me - perhaps Mike can come up with something smarter.

--- a/include/linux/pgtable.h~mm-consolidate-pgd_index-and-pgd_offset_k-definitions-fix
+++ a/include/linux/pgtable.h
@@ -62,11 +62,8 @@ static inline unsigned long pud_index(un
 #endif
 
 #ifndef pgd_index
-static inline unsigned long pgd_index(unsigned long address)
-{
-	return ((address >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1));
-}
-#define pgd_index pgd_index
+/* Must be a compile-time constant, so implement it as a macro */
+#define pgd_index(a)  (((a) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1))
 #endif
 
 #ifndef pte_offset_kernel
_



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

* Re: [linux-next:master 10679/10701] arch/x86/mm/pgtable.c:427:2: warning: variable length array 'u_pmds' is used
  2020-05-20 23:11 ` Andrew Morton
@ 2020-05-20 23:50   ` Randy Dunlap
  2020-05-21  7:02   ` Mike Rapoport
  1 sibling, 0 replies; 5+ messages in thread
From: Randy Dunlap @ 2020-05-20 23:50 UTC (permalink / raw)
  To: Andrew Morton, kbuild test robot
  Cc: Mike Rapoport, kbuild-all, Linux Memory Management List

On 5/20/20 4:11 PM, Andrew Morton wrote:
> On Thu, 21 May 2020 03:56:53 +0800 kbuild test robot <lkp@intel.com> wrote:
> 
>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
>> head:   fb57b1fabcb28f358901b2df90abd2b48abc1ca8
>> commit: 0e19fc1c40bd7516d5a30a459db4f49d48910847 [10679/10701] mm: consolidate pgd_index() and pgd_offset{_k}() definitions
>> config: i386-randconfig-a005-20200520 (attached as .config)
>> compiler: gcc-4.9 (Ubuntu 4.9.3-13ubuntu2) 4.9.3
>> reproduce:
>>         git checkout 0e19fc1c40bd7516d5a30a459db4f49d48910847
>>         # save the attached .config to linux build tree
>>         make ARCH=i386 
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kbuild test robot <lkp@intel.com>
>>
>> All warnings (new ones prefixed by >>, old ones prefixed by <<):
>>
>> arch/x86/mm/pgtable.c: In function 'pgd_alloc':
>>>> arch/x86/mm/pgtable.c:427:2: warning: variable length array 'u_pmds' is used [-Wvla]
>> pmd_t *u_pmds[MAX_PREALLOCATED_USER_PMDS];
>> ^
>>>> arch/x86/mm/pgtable.c:428:2: warning: variable length array 'pmds' is used [-Wvla]
>> pmd_t *pmds[MAX_PREALLOCATED_PMDS];
>> ^
> 
> Thanks.  This works for me - perhaps Mike can come up with something smarter.

Works for me too. Thanks.

Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested

> --- a/include/linux/pgtable.h~mm-consolidate-pgd_index-and-pgd_offset_k-definitions-fix
> +++ a/include/linux/pgtable.h
> @@ -62,11 +62,8 @@ static inline unsigned long pud_index(un
>  #endif
>  
>  #ifndef pgd_index
> -static inline unsigned long pgd_index(unsigned long address)
> -{
> -	return ((address >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1));
> -}
> -#define pgd_index pgd_index
> +/* Must be a compile-time constant, so implement it as a macro */
> +#define pgd_index(a)  (((a) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1))
>  #endif
>  
>  #ifndef pte_offset_kernel
> _
> 
> 


-- 
~Randy


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

* Re: [linux-next:master 10679/10701] arch/x86/mm/pgtable.c:427:2: warning: variable length array 'u_pmds' is used
  2020-05-20 23:11 ` Andrew Morton
  2020-05-20 23:50   ` Randy Dunlap
@ 2020-05-21  7:02   ` Mike Rapoport
  1 sibling, 0 replies; 5+ messages in thread
From: Mike Rapoport @ 2020-05-21  7:02 UTC (permalink / raw)
  To: Andrew Morton
  Cc: kbuild test robot, kbuild-all, Linux Memory Management List,
	Randy Dunlap

On Wed, May 20, 2020 at 04:11:01PM -0700, Andrew Morton wrote:
> On Thu, 21 May 2020 03:56:53 +0800 kbuild test robot <lkp@intel.com> wrote:
> 
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > head:   fb57b1fabcb28f358901b2df90abd2b48abc1ca8
> > commit: 0e19fc1c40bd7516d5a30a459db4f49d48910847 [10679/10701] mm: consolidate pgd_index() and pgd_offset{_k}() definitions
> > config: i386-randconfig-a005-20200520 (attached as .config)
> > compiler: gcc-4.9 (Ubuntu 4.9.3-13ubuntu2) 4.9.3
> > reproduce:
> >         git checkout 0e19fc1c40bd7516d5a30a459db4f49d48910847
> >         # save the attached .config to linux build tree
> >         make ARCH=i386 
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kbuild test robot <lkp@intel.com>
> > 
> > All warnings (new ones prefixed by >>, old ones prefixed by <<):
> > 
> > arch/x86/mm/pgtable.c: In function 'pgd_alloc':
> > >> arch/x86/mm/pgtable.c:427:2: warning: variable length array 'u_pmds' is used [-Wvla]
> > pmd_t *u_pmds[MAX_PREALLOCATED_USER_PMDS];
> > ^
> > >> arch/x86/mm/pgtable.c:428:2: warning: variable length array 'pmds' is used [-Wvla]
> > pmd_t *pmds[MAX_PREALLOCATED_PMDS];
> > ^
> 
> Thanks.  This works for me - perhaps Mike can come up with something smarter.

Not really :)
Thanks for the fix!

Acked-by: Mike Rapoport <rppt@linux.ibm.com>

> --- a/include/linux/pgtable.h~mm-consolidate-pgd_index-and-pgd_offset_k-definitions-fix
> +++ a/include/linux/pgtable.h
> @@ -62,11 +62,8 @@ static inline unsigned long pud_index(un
>  #endif
>  
>  #ifndef pgd_index
> -static inline unsigned long pgd_index(unsigned long address)
> -{
> -	return ((address >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1));
> -}
> -#define pgd_index pgd_index
> +/* Must be a compile-time constant, so implement it as a macro */
> +#define pgd_index(a)  (((a) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1))
>  #endif
>  
>  #ifndef pte_offset_kernel
> _
> 

-- 
Sincerely yours,
Mike.


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

end of thread, other threads:[~2020-05-21  7:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-20 19:56 [linux-next:master 10679/10701] arch/x86/mm/pgtable.c:427:2: warning: variable length array 'u_pmds' is used kbuild test robot
2020-05-20 20:58 ` Randy Dunlap
2020-05-20 23:11 ` Andrew Morton
2020-05-20 23:50   ` Randy Dunlap
2020-05-21  7:02   ` Mike Rapoport

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).