From: Andrew Morton <akpm@linux-foundation.org>
To: kbuild test robot <lkp@intel.com>
Cc: Mike Rapoport <rppt@linux.ibm.com>,
kbuild-all@lists.01.org,
Linux Memory Management List <linux-mm@kvack.org>,
Randy Dunlap <rdunlap@infradead.org>
Subject: Re: [linux-next:master 10679/10701] arch/x86/mm/pgtable.c:427:2: warning: variable length array 'u_pmds' is used
Date: Wed, 20 May 2020 16:11:01 -0700 [thread overview]
Message-ID: <20200520161101.46deeeaac1cff608573ccec3@linux-foundation.org> (raw)
In-Reply-To: <202005210343.GBNjOjOX%lkp@intel.com>
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
_
next prev parent reply other threads:[~2020-05-20 23:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-20 19:56 kbuild test robot
2020-05-20 20:58 ` Randy Dunlap
2020-05-20 23:11 ` Andrew Morton [this message]
2020-05-20 23:50 ` Randy Dunlap
2020-05-21 7:02 ` Mike Rapoport
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200520161101.46deeeaac1cff608573ccec3@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=kbuild-all@lists.01.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=rdunlap@infradead.org \
--cc=rppt@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox