* [linux-next:master 1981/2307] mm/hugetlb.c:3091:39: warning: array subscript 4294967295 is above array bounds of 'struct list_head[1]'
@ 2026-07-01 23:38 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-07-01 23:38 UTC (permalink / raw)
To: Muchun Song; +Cc: oe-kbuild-all, Andrew Morton, Linux Memory Management List
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 4f441960e691d37c880d2cc004de06bb5b6bd5e4
commit: 307959669e447b936fbe286c4fa8eb440b5645da [1981/2307] mm/hugetlb: remove unused bootmem cma field
config: sparc-randconfig-r062-20260702 (https://download.01.org/0day-ci/archive/20260702/202607020711.qYf0IlRF-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260702/202607020711.qYf0IlRF-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202607020711.qYf0IlRF-lkp@intel.com/
All warnings (new ones prefixed by >>):
mm/hugetlb.c: In function 'alloc_bootmem_huge_page':
>> mm/hugetlb.c:3091:39: warning: array subscript 4294967295 is above array bounds of 'struct list_head[1]' [-Warray-bounds]
list_add(&m->list, &huge_boot_pages[nid_request]);
~~~~~~~~~~~~~~~^~~~~~~~~~~~~
In file included from mm/hugetlb.c:6:
>> include/linux/list.h:177:2: warning: array subscript -1 is below array bounds of 'struct list_head[1]' [-Warray-bounds]
__list_add(new, head, head->next);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +3091 mm/hugetlb.c
aa888a74977a8f2 Andi Kleen 2008-07-23 3059
0f9d5ef0522a273 Muchun Song 2026-06-12 3060 static bool __init alloc_bootmem_huge_page(struct hstate *h, int nid)
0f9d5ef0522a273 Muchun Song 2026-06-12 3061 {
f48ee682d55e360 Muchun Song 2026-06-12 3062 unsigned long pfn;
f48ee682d55e360 Muchun Song 2026-06-12 3063 unsigned int nid_request = nid;
0f9d5ef0522a273 Muchun Song 2026-06-12 3064 struct huge_bootmem_page *m = arch_alloc_bootmem_huge_page(h, nid);
0f9d5ef0522a273 Muchun Song 2026-06-12 3065
0f9d5ef0522a273 Muchun Song 2026-06-12 3066 if (!m)
0f9d5ef0522a273 Muchun Song 2026-06-12 3067 return false;
0f9d5ef0522a273 Muchun Song 2026-06-12 3068
f48ee682d55e360 Muchun Song 2026-06-12 3069 pfn = PHYS_PFN(__pa(m));
f48ee682d55e360 Muchun Song 2026-06-12 3070 nid = early_pfn_to_nid(pfn);
0f9d5ef0522a273 Muchun Song 2026-06-12 3071 /*
0f9d5ef0522a273 Muchun Song 2026-06-12 3072 * Use the beginning of the huge page to store the huge_bootmem_page
0f9d5ef0522a273 Muchun Song 2026-06-12 3073 * struct (until gather_bootmem puts them into the mem_map).
0f9d5ef0522a273 Muchun Song 2026-06-12 3074 *
0f9d5ef0522a273 Muchun Song 2026-06-12 3075 * Put them into a private list first because mem_map is not up yet.
0f9d5ef0522a273 Muchun Song 2026-06-12 3076 */
0f9d5ef0522a273 Muchun Song 2026-06-12 3077 INIT_LIST_HEAD(&m->list);
0f9d5ef0522a273 Muchun Song 2026-06-12 3078 m->hstate = h;
307959669e447b9 Muchun Song 2026-06-12 3079 m->flags = hugetlb_early_cma(h) ? HUGE_BOOTMEM_CMA : 0;
fde1c4ecf91640e Usama Arif 2023-09-13 3080
f48ee682d55e360 Muchun Song 2026-06-12 3081 /* CMA pages: zone-crossing is validated in hugetlb_cma_reserve(). */
f48ee682d55e360 Muchun Song 2026-06-12 3082 if (!hugetlb_early_cma(h) &&
f48ee682d55e360 Muchun Song 2026-06-12 3083 pfn_range_intersects_zones(nid, pfn, pages_per_huge_page(h))) {
f48ee682d55e360 Muchun Song 2026-06-12 3084 /*
f48ee682d55e360 Muchun Song 2026-06-12 3085 * If the allocated page is on a different node than requested
f48ee682d55e360 Muchun Song 2026-06-12 3086 * (e.g., on PowerPC LPARs), put it on the requested node's list,
f48ee682d55e360 Muchun Song 2026-06-12 3087 * because hugetlb_free_cross_zone_pages() only frees cross-zone
f48ee682d55e360 Muchun Song 2026-06-12 3088 * pages belonging to the requested node.
f48ee682d55e360 Muchun Song 2026-06-12 3089 */
f48ee682d55e360 Muchun Song 2026-06-12 3090 if (WARN_ON_ONCE(nid_request != NUMA_NO_NODE && nid != nid_request))
f48ee682d55e360 Muchun Song 2026-06-12 @3091 list_add(&m->list, &huge_boot_pages[nid_request]);
f48ee682d55e360 Muchun Song 2026-06-12 3092 else
f48ee682d55e360 Muchun Song 2026-06-12 3093 list_add(&m->list, &huge_boot_pages[nid]);
f48ee682d55e360 Muchun Song 2026-06-12 3094 } else {
f48ee682d55e360 Muchun Song 2026-06-12 3095 list_add_tail(&m->list, &huge_boot_pages[nid]);
f48ee682d55e360 Muchun Song 2026-06-12 3096 m->flags |= HUGE_BOOTMEM_ZONES_VALID;
fde1c4ecf91640e Usama Arif 2023-09-13 3097 /*
fde1c4ecf91640e Usama Arif 2023-09-13 3098 * Only initialize the head struct page in memmap_init_reserved_pages,
fde1c4ecf91640e Usama Arif 2023-09-13 3099 * rest of the struct pages will be initialized by the HugeTLB
fde1c4ecf91640e Usama Arif 2023-09-13 3100 * subsystem itself.
fde1c4ecf91640e Usama Arif 2023-09-13 3101 * The head struct page is used to get folio information by the HugeTLB
fde1c4ecf91640e Usama Arif 2023-09-13 3102 * subsystem like zone id and node id.
fde1c4ecf91640e Usama Arif 2023-09-13 3103 */
a1e59fc6ee4ed89 Ritesh Harjani (IBM 2026-02-26 3104) memblock_reserved_mark_noinit(__pa((void *)m + PAGE_SIZE),
fde1c4ecf91640e Usama Arif 2023-09-13 3105 huge_page_size(h) - PAGE_SIZE);
f48ee682d55e360 Muchun Song 2026-06-12 3106 }
b1222550fbf7384 Frank van der Linden 2025-02-28 3107
0f9d5ef0522a273 Muchun Song 2026-06-12 3108 return true;
aa888a74977a8f2 Andi Kleen 2008-07-23 3109 }
aa888a74977a8f2 Andi Kleen 2008-07-23 3110
:::::: The code at line 3091 was first introduced by commit
:::::: f48ee682d55e3602fcc194cb93b8398f2546e53f mm/hugetlb: free cross-zone bootmem gigantic pages after allocation
:::::: TO: Muchun Song <songmuchun@bytedance.com>
:::::: CC: Andrew Morton <akpm@linux-foundation.org>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-01 23:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-01 23:38 [linux-next:master 1981/2307] mm/hugetlb.c:3091:39: warning: array subscript 4294967295 is above array bounds of 'struct list_head[1]' kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.