From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA206C433DF for ; Wed, 20 May 2020 23:11:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4E1DD20885 for ; Wed, 20 May 2020 23:11:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="SJI/5MN/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4E1DD20885 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AE56680007; Wed, 20 May 2020 19:11:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A6F2A900002; Wed, 20 May 2020 19:11:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9374880007; Wed, 20 May 2020 19:11:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0246.hostedemail.com [216.40.44.246]) by kanga.kvack.org (Postfix) with ESMTP id 77583900002 for ; Wed, 20 May 2020 19:11:04 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 371938248076 for ; Wed, 20 May 2020 23:11:04 +0000 (UTC) X-FDA: 76838644848.04.sign26_2664c1c6a3550 X-HE-Tag: sign26_2664c1c6a3550 X-Filterd-Recvd-Size: 3399 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf09.hostedemail.com (Postfix) with ESMTP for ; Wed, 20 May 2020 23:11:03 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 66C8F20884; Wed, 20 May 2020 23:11:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590016262; bh=asFCnR7hHZKhzqFdoBbNT4wNUaf7t2UTGcGuaP2Ips4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=SJI/5MN/h8Zhr2aKe4hPQ8Q02cWPF7aJJd4hVkb5txaoCaoYUNKcujZkXK4HaLa4s Ba6dosIhNQtAvC3k72gQTHTbiGVTEhYIpEG1r7Bw9FByI96QZ+Nmd3esW2n0IfihhE QckjkY6P9T1FwX0H6PjtKiuAkYYlgg7ko47vnnpc= Date: Wed, 20 May 2020 16:11:01 -0700 From: Andrew Morton To: kbuild test robot Cc: Mike Rapoport , kbuild-all@lists.01.org, Linux Memory Management List , Randy Dunlap Subject: Re: [linux-next:master 10679/10701] arch/x86/mm/pgtable.c:427:2: warning: variable length array 'u_pmds' is used Message-Id: <20200520161101.46deeeaac1cff608573ccec3@linux-foundation.org> In-Reply-To: <202005210343.GBNjOjOX%lkp@intel.com> References: <202005210343.GBNjOjOX%lkp@intel.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, 21 May 2020 03:56:53 +0800 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 > > 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 _