Message ID | 20230105220151.never.343-kees@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp516188wrt; Thu, 5 Jan 2023 14:08:25 -0800 (PST) X-Google-Smtp-Source: AMrXdXtYk7042SGtp2m3TQH4NRKzvExxAsmSCbn9HnrnopOJZoxnEzmAnn5Hbk3OFI7PCnk8egYy X-Received: by 2002:a17:90b:264d:b0:213:18f3:68d1 with SMTP id pa13-20020a17090b264d00b0021318f368d1mr55226943pjb.29.1672956505241; Thu, 05 Jan 2023 14:08:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672956505; cv=none; d=google.com; s=arc-20160816; b=TFhNX2AKG3l1RWRaf/1oaYB27nSvG1odFgnya5qICmD7aGa6KcTDDLBDCEnUJdq5qI 52QKSRdtog03lIKFl+P9sDKqGvCFf9H2B0NS7/+4WT7r/LG9YljjETkAMOJA8p6NpIdo itFrNyRkcuUznd7v8NB9Yp+RApA6eVbUTip7jr8DDqsl4oH8sMpuL5ZiklB6/avPUZQ6 eBmh0WPqmRnG+9Yt3cgwBrz7LctDw+Er8Zbn8smmJVPHM33J296VS04LEFQaydAWOn/i dms4i2PEDAnuo3QAPhY0gRtemGSVumLqvxXxZep6cMjkn2PeIX5NWzVODfERb2XoBX6+ NaSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=GU4F0A6CghntlAPFlpuG7hCmUocPla4d2Q4HBiVaB3k=; b=bC2H+ozzoRrUujC7c1svcpgIIxQ+0iDmvjZY1vd8mKbS5OKQow1sDp5pWs0QgADErs 065oYaUZQX3WimlIXPP+N/y/bOP5prmUCfbRjR575c4TtyoxZItHYtf9N1D8OWzgV3GK 5IdV6QWyB9VcMJs3PlPG8tenZMDgVHsyl3f1CqMaR7THIoGnvwXa9ehiJH5vo2igsBsC VYdoWeuOh9r4aXYbFpANfXXyLqe0/43/CHfp7p/ME4SF4uk+1D9gf6wK66tdN4ae1Lmj MYzPWdAEieaZNesS6mPgbH3xY3VecBpjbWqQY8WOZazJNxItjO8jFpjmXNVi7BJfBoEp Fl3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=mTH+Pi3R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mh17-20020a17090b4ad100b00205f1a25a31si3160968pjb.161.2023.01.05.14.08.11; Thu, 05 Jan 2023 14:08:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=mTH+Pi3R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235877AbjAEWCC (ORCPT <rfc822;tmhikaru@gmail.com> + 99 others); Thu, 5 Jan 2023 17:02:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235709AbjAEWB5 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 5 Jan 2023 17:01:57 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D2F16950A for <linux-kernel@vger.kernel.org>; Thu, 5 Jan 2023 14:01:56 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id w4-20020a17090ac98400b002186f5d7a4cso3423425pjt.0 for <linux-kernel@vger.kernel.org>; Thu, 05 Jan 2023 14:01:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=GU4F0A6CghntlAPFlpuG7hCmUocPla4d2Q4HBiVaB3k=; b=mTH+Pi3ROqEsjK25XUv/HIFl/ZZBPEhOQWIk/soZxwErT2IfckDSCYXjlhJWs9ypug hfyPaZoxRTq5zBvRSgv3VMmw3jJyytXAts59+xEQbtr3bpXqq23Zv+V/RK2WBLXPqYCt fRDRg4gQgtlwgBJ3z3ia4doa5sW8Sr8N8M5GM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=GU4F0A6CghntlAPFlpuG7hCmUocPla4d2Q4HBiVaB3k=; b=FqEgIn7yqfwE2Tr7a1QzCKe6QUXpPBUEAWK35yZd02DZazb+KYNI06Xp0YBEUUoJY1 970OZeGriFUP0RHvKG9Y1rGFaH7VDuze/nA3tayuVExFEVx2JURzoqHwm4HXC+dZVPqj t+n1lKOj0L0RjB9vjCZvTP49wdg4Y0dbhJNFO5PAX5NmKSO3Dx22Xnv2Q26ja2ji5Ddp okBJJTq1n5urDMKTZ8YcirncUdkcMrcIMN1JH/EjevwUvnPCMxfKn8Oq5DFIyvWw+WjX iiwo1VaUlTd32dm02fcG/bGWGdc4eOyosNbzwsjGQCeoSivFaVcVr/f87hstko/OCmGU ZQZA== X-Gm-Message-State: AFqh2krW8hJL2rPg3Hf4OoXtIdcWx+T2JKtsC7TaKc7eILN6TIMbAwF5 ifJ8xzIST15jtccjgDxCoZx2NA== X-Received: by 2002:a05:6a20:1e5a:b0:9d:efbf:48d7 with SMTP id cy26-20020a056a201e5a00b0009defbf48d7mr56663117pzb.27.1672956116121; Thu, 05 Jan 2023 14:01:56 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id h9-20020a628309000000b00574db8ca00fsm7924258pfe.185.2023.01.05.14.01.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 14:01:55 -0800 (PST) From: Kees Cook <keescook@chromium.org> To: Andrew Morton <akpm@linux-foundation.org> Cc: Kees Cook <keescook@chromium.org>, Dan Williams <dan.j.williams@intel.com>, Alex Sierra <alex.sierra@amd.com>, Felix Kuehling <Felix.Kuehling@amd.com>, "Matthew Wilcox (Oracle)" <willy@infradead.org>, Shiyang Ruan <ruansy.fnst@fujitsu.com>, "Gustavo A. R. Silva" <gustavoars@kernel.org>, linux-mm@kvack.org, Alistair Popple <apopple@nvidia.com>, Joao Martins <joao.m.martins@oracle.com>, Mike Rapoport <rppt@kernel.org>, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH] memremap: Replace 0-length array with flexible array Date: Thu, 5 Jan 2023 14:01:53 -0800 Message-Id: <20230105220151.never.343-kees@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2644; h=from:subject:message-id; bh=wqATlM0Wy6ZUz1F3TRvkHL3pT03iLnEph/fbgS+sn5g=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBjt0jQGs4GvKcEISh+DUGAS/MBAXty4zobHGXMnncR wkthQ0WJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCY7dI0AAKCRCJcvTf3G3AJpIqD/ 0YTMOnoLIq2BdwO/Kzukw8r0GthNIuwD/Zs4fYENGzt1pw16sh9gFyie7bQ9uuvzOzUImgfcoqMT6l GYcn9cU9VCKcv45dtSw5NWxTt30I4Naok6sZ2KEQJyyNxiYs0mXfv/j6ame8zdFCaeSuJjzF1NsC/s JlIyl2OcHHXOHr9AQk+YHlzhwhQ4PLxfPqHVgsSQaU6ygOsUbUqdG5cy8lNg+EmMLuDSzudI/7hBZb CYzdqdsFHDDTjBfivfpo5wG9vwf/+puOdddLEoAK/eL75zvcxVDDkqw5knpCpAU+MQTeJpJkBQqdsz by3KrnXaoaA5xdjveU+mqp+mOdadd/a4SgOwTYdHOvAfuvPe9P1VEkSVDUkp+7nRZQwZwc8PVeBGBX wMOs7ZlUgJvIBCx1DqAsRQUz9Hi7xxnRZPoioyVrPyV4GNPed5bYNnXk/wN/N/7Tw7A1z/dVR3N+DN 7uZmQK7Op1FR7MCa6dP5jCo3FtQ+lgMLWEr7F2xl54WLuDuXt5yhfyCScdHYArvJ95XcXODACD4xN2 W6mQXNFy2+m9yPbmzWZDs+cjL3Jp0l+NAC5l5cjnyXh1nGTm/aF9aeQYblYDl5yYyqDRGHBM+8hPi0 4h8drdjiWhgZEfmJEaq5pk+27Tr4r71W3y7BwztdD3quCAjO90oqnlHHx7RA== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754222040709220856?= X-GMAIL-MSGID: =?utf-8?q?1754222040709220856?= |
Series |
memremap: Replace 0-length array with flexible array
|
|
Commit Message
Kees Cook
Jan. 5, 2023, 10:01 p.m. UTC
Zero-length arrays are deprecated[1]. Replace struct ethtool_rxnfc's
"rule_locs" 0-length array with a flexible array. Detected with GCC 13,
using -fstrict-flex-arrays=3:
In file included from include/asm-generic/memory_model.h:5,
from arch/x86/include/asm/page.h:86,
from arch/x86/include/asm/thread_info.h:12,
from include/linux/thread_info.h:60,
from arch/x86/include/asm/preempt.h:9,
from include/linux/preempt.h:78,
from include/linux/spinlock.h:56,
from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/sparse-vmemmap.c:21:
In function 'reuse_compound_section',
inlined from 'vmemmap_populate_compound_pages' at mm/sparse-vmemmap.c:407:6,
inlined from '__populate_section_memmap' at mm/sparse-vmemmap.c:463:7:
mm/sparse-vmemmap.c:376:39: warning: array subscript <unknown> is outside array bounds of 'struct range[0]' [-Warray-bounds=]
376 | PHYS_PFN(pgmap->ranges[pgmap->nr_range].start);
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
include/linux/pfn.h:22:43: note: in definition of macro 'PHYS_PFN'
22 | #define PHYS_PFN(x) ((unsigned long)((x) >> PAGE_SHIFT))
| ^
In file included from include/linux/mm.h:31:
include/linux/memremap.h: In function '__populate_section_memmap':
include/linux/memremap.h:138:30: note: while referencing 'ranges'
138 | struct range ranges[0];
| ^~~~~~
[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Alex Sierra <alex.sierra@amd.com>
Cc: Felix Kuehling <Felix.Kuehling@amd.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Shiyang Ruan <ruansy.fnst@fujitsu.com>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: linux-mm@kvack.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
include/linux/memremap.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
I think this is the same patch: https://lore.kernel.org/linux-hardening/YxKO%2FjY1x0xTpl4r@work/ It's actually in linux-next. -- Gustavo On Thu, Jan 05, 2023 at 02:01:53PM -0800, Kees Cook wrote: > Zero-length arrays are deprecated[1]. Replace struct ethtool_rxnfc's > "rule_locs" 0-length array with a flexible array. Detected with GCC 13, > using -fstrict-flex-arrays=3: > > In file included from include/asm-generic/memory_model.h:5, > from arch/x86/include/asm/page.h:86, > from arch/x86/include/asm/thread_info.h:12, > from include/linux/thread_info.h:60, > from arch/x86/include/asm/preempt.h:9, > from include/linux/preempt.h:78, > from include/linux/spinlock.h:56, > from include/linux/mmzone.h:8, > from include/linux/gfp.h:7, > from include/linux/mm.h:7, > from mm/sparse-vmemmap.c:21: > In function 'reuse_compound_section', > inlined from 'vmemmap_populate_compound_pages' at mm/sparse-vmemmap.c:407:6, > inlined from '__populate_section_memmap' at mm/sparse-vmemmap.c:463:7: > mm/sparse-vmemmap.c:376:39: warning: array subscript <unknown> is outside array bounds of 'struct range[0]' [-Warray-bounds=] > 376 | PHYS_PFN(pgmap->ranges[pgmap->nr_range].start); > | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ > include/linux/pfn.h:22:43: note: in definition of macro 'PHYS_PFN' > 22 | #define PHYS_PFN(x) ((unsigned long)((x) >> PAGE_SHIFT)) > | ^ > In file included from include/linux/mm.h:31: > include/linux/memremap.h: In function '__populate_section_memmap': > include/linux/memremap.h:138:30: note: while referencing 'ranges' > 138 | struct range ranges[0]; > | ^~~~~~ > > [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays > > Cc: Andrew Morton <akpm@linux-foundation.org> > Cc: Dan Williams <dan.j.williams@intel.com> > Cc: Alex Sierra <alex.sierra@amd.com> > Cc: Felix Kuehling <Felix.Kuehling@amd.com> > Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org> > Cc: Shiyang Ruan <ruansy.fnst@fujitsu.com> > Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org> > Cc: linux-mm@kvack.org > Signed-off-by: Kees Cook <keescook@chromium.org> > --- > include/linux/memremap.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/linux/memremap.h b/include/linux/memremap.h > index 7fcaf3180a5b..1314d9c5f05b 100644 > --- a/include/linux/memremap.h > +++ b/include/linux/memremap.h > @@ -135,7 +135,7 @@ struct dev_pagemap { > int nr_range; > union { > struct range range; > - struct range ranges[0]; > + DECLARE_FLEX_ARRAY(struct range, ranges); > }; > }; > > -- > 2.34.1 >
Kees Cook wrote: > Zero-length arrays are deprecated[1]. Replace struct ethtool_rxnfc's > "rule_locs" 0-length array with a flexible array. Detected with GCC 13, > using -fstrict-flex-arrays=3: > > In file included from include/asm-generic/memory_model.h:5, > from arch/x86/include/asm/page.h:86, > from arch/x86/include/asm/thread_info.h:12, > from include/linux/thread_info.h:60, > from arch/x86/include/asm/preempt.h:9, > from include/linux/preempt.h:78, > from include/linux/spinlock.h:56, > from include/linux/mmzone.h:8, > from include/linux/gfp.h:7, > from include/linux/mm.h:7, > from mm/sparse-vmemmap.c:21: > In function 'reuse_compound_section', > inlined from 'vmemmap_populate_compound_pages' at mm/sparse-vmemmap.c:407:6, > inlined from '__populate_section_memmap' at mm/sparse-vmemmap.c:463:7: > mm/sparse-vmemmap.c:376:39: warning: array subscript <unknown> is outside array bounds of 'struct range[0]' [-Warray-bounds=] > 376 | PHYS_PFN(pgmap->ranges[pgmap->nr_range].start); > | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ > include/linux/pfn.h:22:43: note: in definition of macro 'PHYS_PFN' > 22 | #define PHYS_PFN(x) ((unsigned long)((x) >> PAGE_SHIFT)) > | ^ > In file included from include/linux/mm.h:31: > include/linux/memremap.h: In function '__populate_section_memmap': > include/linux/memremap.h:138:30: note: while referencing 'ranges' > 138 | struct range ranges[0]; > | ^~~~~~ > > [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays > > Cc: Andrew Morton <akpm@linux-foundation.org> > Cc: Dan Williams <dan.j.williams@intel.com> > Cc: Alex Sierra <alex.sierra@amd.com> > Cc: Felix Kuehling <Felix.Kuehling@amd.com> > Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org> > Cc: Shiyang Ruan <ruansy.fnst@fujitsu.com> > Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org> > Cc: linux-mm@kvack.org > Signed-off-by: Kees Cook <keescook@chromium.org> Looks good to me: Reviewed-by: Dan Williams <dan.j.williams@intel.com> > --- > include/linux/memremap.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/linux/memremap.h b/include/linux/memremap.h > index 7fcaf3180a5b..1314d9c5f05b 100644 > --- a/include/linux/memremap.h > +++ b/include/linux/memremap.h > @@ -135,7 +135,7 @@ struct dev_pagemap { > int nr_range; > union { > struct range range; > - struct range ranges[0]; > + DECLARE_FLEX_ARRAY(struct range, ranges); > }; > }; > > -- > 2.34.1 >
On Thu, Jan 05, 2023 at 04:14:05PM -0600, Gustavo A. R. Silva wrote: > I think this is the same patch: > > https://lore.kernel.org/linux-hardening/YxKO%2FjY1x0xTpl4r@work/ > > It's actually in linux-next. Ah-ha! Thank you! I'll move to linux-next for build testing.
On Thu, Jan 05, 2023 at 04:14:05PM -0600, Gustavo A. R. Silva wrote: > I think this is the same patch: > > https://lore.kernel.org/linux-hardening/YxKO%2FjY1x0xTpl4r@work/ > > It's actually in linux-next. Hm, it's been in -next since September? Is this in a tree of yours that didn't get pulled for v6.2?
On 1/5/23 16:41, Kees Cook wrote: > On Thu, Jan 05, 2023 at 04:14:05PM -0600, Gustavo A. R. Silva wrote: >> I think this is the same patch: >> >> https://lore.kernel.org/linux-hardening/YxKO%2FjY1x0xTpl4r@work/ >> >> It's actually in linux-next. > > Hm, it's been in -next since September? Is this in a tree of yours that > didn't get pulled for v6.2? No. I didn't send it. It's just one of the two patches I have in my -next tree. They didn't look like high priority at the time. -- Gustavo
On Thu, Jan 05, 2023 at 05:14:23PM -0600, Gustavo A. R. Silva wrote: > > > On 1/5/23 16:41, Kees Cook wrote: > > On Thu, Jan 05, 2023 at 04:14:05PM -0600, Gustavo A. R. Silva wrote: > > > I think this is the same patch: > > > > > > https://lore.kernel.org/linux-hardening/YxKO%2FjY1x0xTpl4r@work/ > > > > > > It's actually in linux-next. > > > > Hm, it's been in -next since September? Is this in a tree of yours that > > didn't get pulled for v6.2? > > No. I didn't send it. It's just one of the two patches I have in my -next > tree. They didn't look like high priority at the time. Cool. I'd like to get -fstrict-flex-arrays=3 finished this devel cycle, if possible. Can you add this one too? https://lore.kernel.org/lkml/YzIc8z+QaHvqPjLX@work I don't see it in patchwork which I find confusing too. :P
On Thu, Jan 05, 2023 at 03:37:03PM -0800, Kees Cook wrote: > On Thu, Jan 05, 2023 at 05:14:23PM -0600, Gustavo A. R. Silva wrote: > > > > > > On 1/5/23 16:41, Kees Cook wrote: > > > On Thu, Jan 05, 2023 at 04:14:05PM -0600, Gustavo A. R. Silva wrote: > > > > I think this is the same patch: > > > > > > > > https://lore.kernel.org/linux-hardening/YxKO%2FjY1x0xTpl4r@work/ > > > > > > > > It's actually in linux-next. > > > > > > Hm, it's been in -next since September? Is this in a tree of yours that > > > didn't get pulled for v6.2? > > > > No. I didn't send it. It's just one of the two patches I have in my -next > > tree. They didn't look like high priority at the time. > > Cool. I'd like to get -fstrict-flex-arrays=3 finished this devel cycle, > if possible. Can you add this one too? > > https://lore.kernel.org/lkml/YzIc8z+QaHvqPjLX@work Done! https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/log/?h=for-next/kspp > > I don't see it in patchwork which I find confusing too. :P mmh... and I don't remember updating it in patchwork before. (thinkingface) -- Gustavo
diff --git a/include/linux/memremap.h b/include/linux/memremap.h index 7fcaf3180a5b..1314d9c5f05b 100644 --- a/include/linux/memremap.h +++ b/include/linux/memremap.h @@ -135,7 +135,7 @@ struct dev_pagemap { int nr_range; union { struct range range; - struct range ranges[0]; + DECLARE_FLEX_ARRAY(struct range, ranges); }; };