Message ID | 20230315113133.11326-1-kirill.shutemov@linux.intel.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2273215wrd; Wed, 15 Mar 2023 04:33:56 -0700 (PDT) X-Google-Smtp-Source: AK7set9TCFlyxXaQ1Q4Zu/nuMQka0cF1oghdnV6pw/HZXOOPVw7JJJLLBRtVVw5YUsz4DyBj0Woy X-Received: by 2002:a5d:929a:0:b0:74d:770:f4b7 with SMTP id s26-20020a5d929a000000b0074d0770f4b7mr26470840iom.9.1678880036457; Wed, 15 Mar 2023 04:33:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678880036; cv=none; d=google.com; s=arc-20160816; b=1H3DdLDuwNWddJ8rkrRUmANlT9bXTIG3IyGIRg6ciyV1X1aAxkp7m0A8DN9W8W06Un Kbc7ZzthrEELLJgVbZuOlBZYsKWD4WJxNZFIaz6aRTFSqyr828eMUvI5Kc0a/2kEgs0x U3QQ43vVOFIUKqoQyYGOm/LvBcxH6vm7Q92CdAYTOOv+Gs27UlBMWryOImpBoaoi4bp9 mAEhQFqlXlo9RgU84TH+QKyItkPCYt+dSjR6GYc7bnqYxIpsxCR6hvOickfTws0cfrpc FYL4mQNjOdmGmFqVH2MGmp87qm4a/4+qu92MFphdkcg2rHyWe3cefRxW+w+J7v68tKlt Wxgw== 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=VW3gFPpsCm8N47wABgitY+eyUKPIm1zewamHhleTKiU=; b=eYku2wUWUzRF3efND6GkHgOF7ZrvCj3EhO8ajSsXdzLoQKbi0wkfexlE8fdl193hG2 9iBuXqb5KqNz/mabNX7Mf9OFYWkRRUWzxPzRk4CMK9UYEed9R4GL++ozrnT6AuM0gN+/ khO8kcfRlnzCoIgXtXyNXnVZ4Hbs6avL1zILnfJovQVhxV7UfaI80fVTWR+ZGYGVkzmK F6ESZaPiVgk+u9VnNtjeJoMqrhOOdD9K0RYmjzWkIeEeJ6Zh86sLLjxcztOsJmBP79f1 K8aM3eUSNNIguYIJzcAEPGkY1JxJ+fOyh9NHhzNLqgLxpX5s6DQctpPqr+PlwNOpXCsj KJmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YBQo49A5; 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=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k19-20020a5d9d53000000b00752e415868esi2414513iok.94.2023.03.15.04.33.43; Wed, 15 Mar 2023 04:33:56 -0700 (PDT) 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=@intel.com header.s=Intel header.b=YBQo49A5; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231753AbjCOLb6 (ORCPT <rfc822;ruipengqi7@gmail.com> + 99 others); Wed, 15 Mar 2023 07:31:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231529AbjCOLbp (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 15 Mar 2023 07:31:45 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53EAF64849; Wed, 15 Mar 2023 04:31:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678879904; x=1710415904; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=emKW1DsDd6J7BoaliTpiqaTlAsPQ1Xr/3FNEg+io6NQ=; b=YBQo49A55PKeoUSU5BCFs2agz8PmUVtJt+YZOEMAV1NMkBxtToYRazVt AjDCbSdgAmSN7D5bJ5pD2S6CIOUJiHmluUnsrXOzm5BA4RdYyuF0Bq1YX nFJR3h6ZfsZQyXG6LFqv/Qo8C8SBqjHCfPIadtNiIUdQWHLtrXsRZqmoo vl8+VtnTak+6fzh0WqvKVMahp1Obxqdcsvy5BrWjrbT88csIPqfYpTB5Q 1yOJ2CCVvjqMYd4ATlxJTyQhLOpqbU77U4u/om5trkG3oB0lK52VH7PLK 4zmsCy11YVDQ7iRTtFEL9o7ud4iDKpU8uedSSGuiPcnfyaBlM1ApDC3I2 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="340040093" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="340040093" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2023 04:31:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="768455999" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="768455999" Received: from nopopovi-mobl1.ger.corp.intel.com (HELO box.shutemov.name) ([10.252.33.48]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2023 04:31:38 -0700 Received: by box.shutemov.name (Postfix, from userid 1000) id A507B10CC9C; Wed, 15 Mar 2023 14:31:35 +0300 (+03) From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> To: Andrew Morton <akpm@linux-foundation.org>, Mel Gorman <mgorman@suse.de>, Vlastimil Babka <vbabka@suse.cz>, David Hildenbrand <david@redhat.com> Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> Subject: [PATCH 00/10] Fix confusion around MAX_ORDER Date: Wed, 15 Mar 2023 14:31:23 +0300 Message-Id: <20230315113133.11326-1-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,URIBL_BLOCKED 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?1760433313047150722?= X-GMAIL-MSGID: =?utf-8?q?1760433313047150722?= |
Series |
Fix confusion around MAX_ORDER
|
|
Message
Kirill A. Shutemov
March 15, 2023, 11:31 a.m. UTC
MAX_ORDER currently defined as number of orders page allocator supports: user can ask buddy allocator for page order between 0 and MAX_ORDER-1. This definition is counter-intuitive and lead to number of bugs all over the kernel. Fix the bugs and then change the definition of MAX_ORDER to be inclusive: the range of orders user can ask from buddy allocator is 0..MAX_ORDER now. Kirill A. Shutemov (10): sparc/mm: Fix MAX_ORDER usage in tsb_grow() um: Fix MAX_ORDER usage in linux_main() floppy: Fix MAX_ORDER usage drm/i915: Fix MAX_ORDER usage in i915_gem_object_get_pages_internal() genwqe: Fix MAX_ORDER usage perf/core: Fix MAX_ORDER usage in rb_alloc_aux_page() mm/page_reporting: Fix MAX_ORDER usage in page_reporting_register() mm/slub: Fix MAX_ORDER usage in calculate_order() iommu: Fix MAX_ORDER usage in __iommu_dma_alloc_pages() mm, treewide: Redefine MAX_ORDER sanely .../admin-guide/kdump/vmcoreinfo.rst | 2 +- .../admin-guide/kernel-parameters.txt | 2 +- arch/arc/Kconfig | 4 +- arch/arm/Kconfig | 9 ++--- arch/arm/configs/imx_v6_v7_defconfig | 2 +- arch/arm/configs/milbeaut_m10v_defconfig | 2 +- arch/arm/configs/oxnas_v6_defconfig | 2 +- arch/arm/configs/pxa_defconfig | 2 +- arch/arm/configs/sama7_defconfig | 2 +- arch/arm/configs/sp7021_defconfig | 2 +- arch/arm64/Kconfig | 27 ++++++------- arch/arm64/include/asm/sparsemem.h | 2 +- arch/arm64/kvm/hyp/include/nvhe/gfp.h | 2 +- arch/arm64/kvm/hyp/nvhe/page_alloc.c | 10 ++--- arch/csky/Kconfig | 2 +- arch/ia64/Kconfig | 8 ++-- arch/ia64/include/asm/sparsemem.h | 4 +- arch/ia64/mm/hugetlbpage.c | 2 +- arch/loongarch/Kconfig | 15 +++----- arch/m68k/Kconfig.cpu | 5 +-- arch/mips/Kconfig | 19 ++++------ arch/nios2/Kconfig | 7 +--- arch/powerpc/Kconfig | 27 ++++++------- arch/powerpc/configs/85xx/ge_imp3a_defconfig | 2 +- arch/powerpc/configs/fsl-emb-nonhw.config | 2 +- arch/powerpc/mm/book3s64/iommu_api.c | 2 +- arch/powerpc/mm/hugetlbpage.c | 2 +- arch/powerpc/platforms/powernv/pci-ioda.c | 2 +- arch/sh/configs/ecovec24_defconfig | 2 +- arch/sh/mm/Kconfig | 17 ++++----- arch/sparc/Kconfig | 5 +-- arch/sparc/kernel/pci_sun4v.c | 2 +- arch/sparc/kernel/traps_64.c | 2 +- arch/sparc/mm/tsb.c | 4 +- arch/xtensa/Kconfig | 5 +-- drivers/base/regmap/regmap-debugfs.c | 8 ++-- drivers/block/floppy.c | 2 +- drivers/crypto/ccp/sev-dev.c | 2 +- drivers/crypto/hisilicon/sgl.c | 6 +-- .../gpu/drm/i915/gem/selftests/huge_pages.c | 2 +- drivers/gpu/drm/ttm/ttm_pool.c | 22 +++++------ drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 2 +- drivers/iommu/dma-iommu.c | 4 +- drivers/irqchip/irq-gic-v3-its.c | 4 +- drivers/md/dm-bufio.c | 2 +- drivers/misc/genwqe/card_utils.c | 2 +- .../net/ethernet/hisilicon/hns3/hns3_enet.c | 2 +- drivers/net/ethernet/ibm/ibmvnic.h | 2 +- drivers/video/fbdev/hyperv_fb.c | 4 +- drivers/video/fbdev/vermilion/vermilion.c | 2 +- drivers/virtio/virtio_balloon.c | 2 +- drivers/virtio/virtio_mem.c | 12 +++--- fs/ramfs/file-nommu.c | 2 +- include/drm/ttm/ttm_pool.h | 2 +- include/linux/hugetlb.h | 2 +- include/linux/mmzone.h | 10 ++--- include/linux/pageblock-flags.h | 4 +- include/linux/slab.h | 6 +-- kernel/crash_core.c | 2 +- kernel/dma/pool.c | 6 +-- mm/Kconfig | 6 +-- mm/compaction.c | 8 ++-- mm/debug_vm_pgtable.c | 4 +- mm/huge_memory.c | 2 +- mm/hugetlb.c | 4 +- mm/kmsan/init.c | 6 +-- mm/memblock.c | 2 +- mm/memory_hotplug.c | 4 +- mm/page_alloc.c | 38 +++++++++---------- mm/page_isolation.c | 12 +++--- mm/page_owner.c | 6 +-- mm/page_reporting.c | 4 +- mm/shuffle.h | 2 +- mm/slab.c | 2 +- mm/slub.c | 4 +- mm/vmscan.c | 2 +- mm/vmstat.c | 14 +++---- net/smc/smc_ib.c | 2 +- security/integrity/ima/ima_crypto.c | 2 +- tools/testing/memblock/linux/mmzone.h | 6 +-- 80 files changed, 210 insertions(+), 240 deletions(-)
Comments
On Wed, Mar 15, 2023 at 02:31:23PM +0300, Kirill A. Shutemov wrote: > MAX_ORDER currently defined as number of orders page allocator supports: > user can ask buddy allocator for page order between 0 and MAX_ORDER-1. > > This definition is counter-intuitive and lead to number of bugs all over > the kernel. > > Fix the bugs and then change the definition of MAX_ORDER to be > inclusive: the range of orders user can ask from buddy allocator is > 0..MAX_ORDER now. > Acked-by: Mel Gorman <mgorman@suse.de> Overall looks sane other than the fixups that need to be added as flagged by LKP. There is a mild risk for stable backports that reference MAX_ORDER but that's the responsibilty of who is doing the backport. There is a mild risk of muscle memory adding off-by-one errors for new code using MAX_ORDER but it's low.
From: Mel Gorman > Sent: 21 March 2023 16:39 > > On Wed, Mar 15, 2023 at 02:31:23PM +0300, Kirill A. Shutemov wrote: > > MAX_ORDER currently defined as number of orders page allocator supports: > > user can ask buddy allocator for page order between 0 and MAX_ORDER-1. > > > > This definition is counter-intuitive and lead to number of bugs all over > > the kernel. > > > > Fix the bugs and then change the definition of MAX_ORDER to be > > inclusive: the range of orders user can ask from buddy allocator is > > 0..MAX_ORDER now. > > > > Acked-by: Mel Gorman <mgorman@suse.de> > > Overall looks sane other than the fixups that need to be added as > flagged by LKP. There is a mild risk for stable backports that reference > MAX_ORDER but that's the responsibilty of who is doing the backport. > There is a mild risk of muscle memory adding off-by-one errors for new > code using MAX_ORDER but it's low. How many of the places that use MAX_ORDER weren't touched? Is it actually worth changing the name at the same time. That will stop stable backport issues. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
On 3/15/23 12:31, Kirill A. Shutemov wrote: > MAX_ORDER currently defined as number of orders page allocator supports: > user can ask buddy allocator for page order between 0 and MAX_ORDER-1. > > This definition is counter-intuitive and lead to number of bugs all over > the kernel. > > Fix the bugs and then change the definition of MAX_ORDER to be > inclusive: the range of orders user can ask from buddy allocator is > 0..MAX_ORDER now. Looks like this crossed with three changes that introduced new uses of MAX_ORDER: drivers/accel/qaic/qaic_data.c: max_order = min(MAX_ORDER - 1, get_order(size)); drivers/md/dm-crypt.c: unsigned int order = MAX_ORDER - 1; drivers/md/dm-flakey.c: order = MAX_ORDER - 1; The bugs are all benign, MAX_ORDER - 1 can simply be changed to MAX_ORDER to be consistent with the new world order. CCing relevant maintainers... Paolo > Kirill A. Shutemov (10): > sparc/mm: Fix MAX_ORDER usage in tsb_grow() > um: Fix MAX_ORDER usage in linux_main() > floppy: Fix MAX_ORDER usage > drm/i915: Fix MAX_ORDER usage in i915_gem_object_get_pages_internal() > genwqe: Fix MAX_ORDER usage > perf/core: Fix MAX_ORDER usage in rb_alloc_aux_page() > mm/page_reporting: Fix MAX_ORDER usage in page_reporting_register() > mm/slub: Fix MAX_ORDER usage in calculate_order() > iommu: Fix MAX_ORDER usage in __iommu_dma_alloc_pages() > mm, treewide: Redefine MAX_ORDER sanely > > .../admin-guide/kdump/vmcoreinfo.rst | 2 +- > .../admin-guide/kernel-parameters.txt | 2 +- > arch/arc/Kconfig | 4 +- > arch/arm/Kconfig | 9 ++--- > arch/arm/configs/imx_v6_v7_defconfig | 2 +- > arch/arm/configs/milbeaut_m10v_defconfig | 2 +- > arch/arm/configs/oxnas_v6_defconfig | 2 +- > arch/arm/configs/pxa_defconfig | 2 +- > arch/arm/configs/sama7_defconfig | 2 +- > arch/arm/configs/sp7021_defconfig | 2 +- > arch/arm64/Kconfig | 27 ++++++------- > arch/arm64/include/asm/sparsemem.h | 2 +- > arch/arm64/kvm/hyp/include/nvhe/gfp.h | 2 +- > arch/arm64/kvm/hyp/nvhe/page_alloc.c | 10 ++--- > arch/csky/Kconfig | 2 +- > arch/ia64/Kconfig | 8 ++-- > arch/ia64/include/asm/sparsemem.h | 4 +- > arch/ia64/mm/hugetlbpage.c | 2 +- > arch/loongarch/Kconfig | 15 +++----- > arch/m68k/Kconfig.cpu | 5 +-- > arch/mips/Kconfig | 19 ++++------ > arch/nios2/Kconfig | 7 +--- > arch/powerpc/Kconfig | 27 ++++++------- > arch/powerpc/configs/85xx/ge_imp3a_defconfig | 2 +- > arch/powerpc/configs/fsl-emb-nonhw.config | 2 +- > arch/powerpc/mm/book3s64/iommu_api.c | 2 +- > arch/powerpc/mm/hugetlbpage.c | 2 +- > arch/powerpc/platforms/powernv/pci-ioda.c | 2 +- > arch/sh/configs/ecovec24_defconfig | 2 +- > arch/sh/mm/Kconfig | 17 ++++----- > arch/sparc/Kconfig | 5 +-- > arch/sparc/kernel/pci_sun4v.c | 2 +- > arch/sparc/kernel/traps_64.c | 2 +- > arch/sparc/mm/tsb.c | 4 +- > arch/xtensa/Kconfig | 5 +-- > drivers/base/regmap/regmap-debugfs.c | 8 ++-- > drivers/block/floppy.c | 2 +- > drivers/crypto/ccp/sev-dev.c | 2 +- > drivers/crypto/hisilicon/sgl.c | 6 +-- > .../gpu/drm/i915/gem/selftests/huge_pages.c | 2 +- > drivers/gpu/drm/ttm/ttm_pool.c | 22 +++++------ > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 2 +- > drivers/iommu/dma-iommu.c | 4 +- > drivers/irqchip/irq-gic-v3-its.c | 4 +- > drivers/md/dm-bufio.c | 2 +- > drivers/misc/genwqe/card_utils.c | 2 +- > .../net/ethernet/hisilicon/hns3/hns3_enet.c | 2 +- > drivers/net/ethernet/ibm/ibmvnic.h | 2 +- > drivers/video/fbdev/hyperv_fb.c | 4 +- > drivers/video/fbdev/vermilion/vermilion.c | 2 +- > drivers/virtio/virtio_balloon.c | 2 +- > drivers/virtio/virtio_mem.c | 12 +++--- > fs/ramfs/file-nommu.c | 2 +- > include/drm/ttm/ttm_pool.h | 2 +- > include/linux/hugetlb.h | 2 +- > include/linux/mmzone.h | 10 ++--- > include/linux/pageblock-flags.h | 4 +- > include/linux/slab.h | 6 +-- > kernel/crash_core.c | 2 +- > kernel/dma/pool.c | 6 +-- > mm/Kconfig | 6 +-- > mm/compaction.c | 8 ++-- > mm/debug_vm_pgtable.c | 4 +- > mm/huge_memory.c | 2 +- > mm/hugetlb.c | 4 +- > mm/kmsan/init.c | 6 +-- > mm/memblock.c | 2 +- > mm/memory_hotplug.c | 4 +- > mm/page_alloc.c | 38 +++++++++---------- > mm/page_isolation.c | 12 +++--- > mm/page_owner.c | 6 +-- > mm/page_reporting.c | 4 +- > mm/shuffle.h | 2 +- > mm/slab.c | 2 +- > mm/slub.c | 4 +- > mm/vmscan.c | 2 +- > mm/vmstat.c | 14 +++---- > net/smc/smc_ib.c | 2 +- > security/integrity/ima/ima_crypto.c | 2 +- > tools/testing/memblock/linux/mmzone.h | 6 +-- > 80 files changed, 210 insertions(+), 240 deletions(-) >
On Wed, 27 Sep 2023, Paolo Bonzini wrote: > On 3/15/23 12:31, Kirill A. Shutemov wrote: > > MAX_ORDER currently defined as number of orders page allocator supports: > > user can ask buddy allocator for page order between 0 and MAX_ORDER-1. > > > > This definition is counter-intuitive and lead to number of bugs all over > > the kernel. > > > > Fix the bugs and then change the definition of MAX_ORDER to be > > inclusive: the range of orders user can ask from buddy allocator is > > 0..MAX_ORDER now. I think that exclusive MAX_ORDER is more intuitive in the C language - i.e. if you write "for (i = 0; i < MAX_ORDER; i++)", you are supposed to loop over all allowed values. If you declare an array "void *array[MAX_ORDER];" you are supposed to hold a value for each allowed order. Pascal has for loops and array dimensions with inclusive ranges - and it is more prone to off-by-one errors. Mikulas
On 9/28/23 09:50, Mikulas Patocka wrote: >>> Fix the bugs and then change the definition of MAX_ORDER to be >>> inclusive: the range of orders user can ask from buddy allocator is >>> 0..MAX_ORDER now. > I think that exclusive MAX_ORDER is more intuitive in the C language - > i.e. if you write "for (i = 0; i < MAX_ORDER; i++)", you are supposed to > loop over all allowed values. If you declare an array "void > *array[MAX_ORDER];" you are supposed to hold a value for each allowed > order. > > Pascal has for loops and array dimensions with inclusive ranges - and it > is more prone to off-by-one errors. I agree it's somewhat confusing either way but the ship has sailed, the patch has been included in Linux for several months. Paolo
On Thu 2023-09-28 18:57:18, Paolo Bonzini wrote: > On 9/28/23 09:50, Mikulas Patocka wrote: > > > > Fix the bugs and then change the definition of MAX_ORDER to be > > > > inclusive: the range of orders user can ask from buddy allocator is > > > > 0..MAX_ORDER now. > > I think that exclusive MAX_ORDER is more intuitive in the C language - > > i.e. if you write "for (i = 0; i < MAX_ORDER; i++)", you are supposed to > > loop over all allowed values. If you declare an array "void > > *array[MAX_ORDER];" you are supposed to hold a value for each allowed > > order. > > > > Pascal has for loops and array dimensions with inclusive ranges - and it > > is more prone to off-by-one errors. > > I agree it's somewhat confusing either way but the ship has sailed, the > patch has been included in Linux for several months. Just make sure people don't backport it to stable. Fixes: (the commit that causes the semantic change) should do the trick. BR, Pavel