Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 8777/13479] mm/hugetlb.c:3095:39: warning: array subscript 4294967295 is above array bounds of 'struct list_head[1]'
@ 2026-08-06 21:01 kernel test robot
  2026-08-06 23:36 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2026-08-06 21:01 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:   ea2bff00da89d7767d677bb68470130ba96f4928
commit: 20549ccf4da49ff6dcb35ffc741f92aa92e07aeb [8777/13479] mm/hugetlb: free cross-zone bootmem gigantic pages after allocation
config: parisc-randconfig-002-20260807 (https://download.01.org/0day-ci/archive/20260807/202608070433.x3vNSfjt-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260807/202608070433.x3vNSfjt-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/202608070433.x3vNSfjt-lkp@intel.com/

All warnings (new ones prefixed by >>):

   mm/hugetlb.c: In function 'alloc_bootmem_huge_page':
>> mm/hugetlb.c:3095: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:163:12: warning: array subscript -1 is below array bounds of 'struct list_head[1]' [-Warray-bounds]
     new->prev = prev;
     ~~~~~~~~~~^~~~~~


vim +3095 mm/hugetlb.c

  3060	
  3061	static bool __init alloc_bootmem_huge_page(struct hstate *h, int nid)
  3062	{
  3063		unsigned long pfn;
  3064		unsigned int nid_request = nid;
  3065		struct huge_bootmem_page *m = arch_alloc_bootmem_huge_page(h, nid);
  3066	
  3067		if (!m)
  3068			return false;
  3069	
  3070		pfn = PHYS_PFN(__pa(m));
  3071		nid = early_pfn_to_nid(pfn);
  3072		/*
  3073		 * Use the beginning of the huge page to store the huge_bootmem_page
  3074		 * struct (until gather_bootmem puts them into the mem_map).
  3075		 *
  3076		 * Put them into a private list first because mem_map is not up yet.
  3077		 */
  3078		INIT_LIST_HEAD(&m->list);
  3079		m->hstate = h;
  3080		if (!hugetlb_early_cma(h)) {
  3081			m->cma = NULL;
  3082			m->flags = 0;
  3083		}
  3084	
  3085		/* CMA pages: zone-crossing is validated in hugetlb_cma_reserve(). */
  3086		if (!hugetlb_early_cma(h) &&
  3087		    pfn_range_intersects_zones(nid, pfn, pages_per_huge_page(h))) {
  3088			/*
  3089			 * If the allocated page is on a different node than requested
  3090			 * (e.g., on PowerPC LPARs), put it on the requested node's list,
  3091			 * because hugetlb_free_cross_zone_pages() only frees cross-zone
  3092			 * pages belonging to the requested node.
  3093			 */
  3094			if (WARN_ON_ONCE(nid_request != NUMA_NO_NODE && nid != nid_request))
> 3095				list_add(&m->list, &huge_boot_pages[nid_request]);
  3096			else
  3097				list_add(&m->list, &huge_boot_pages[nid]);
  3098		} else {
  3099			list_add_tail(&m->list, &huge_boot_pages[nid]);
  3100			m->flags |= HUGE_BOOTMEM_ZONES_VALID;
  3101			/*
  3102			 * Only initialize the head struct page in memmap_init_reserved_pages,
  3103			 * rest of the struct pages will be initialized by the HugeTLB
  3104			 * subsystem itself.
  3105			 * The head struct page is used to get folio information by the HugeTLB
  3106			 * subsystem like zone id and node id.
  3107			 */
  3108			memblock_reserved_mark_noinit(__pa((void *)m + PAGE_SIZE),
  3109					huge_page_size(h) - PAGE_SIZE);
  3110		}
  3111	
  3112		return true;
  3113	}
  3114	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [linux-next:master 8777/13479] mm/hugetlb.c:3095:39: warning: array subscript 4294967295 is above array bounds of 'struct list_head[1]'
  2026-08-06 21:01 [linux-next:master 8777/13479] mm/hugetlb.c:3095:39: warning: array subscript 4294967295 is above array bounds of 'struct list_head[1]' kernel test robot
@ 2026-08-06 23:36 ` Andrew Morton
  2026-08-07 11:46   ` Muchun Song
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2026-08-06 23:36 UTC (permalink / raw)
  To: kernel test robot
  Cc: Muchun Song, oe-kbuild-all, Linux Memory Management List

On Fri, 07 Aug 2026 05:01:04 +0800 kernel test robot <lkp@intel.com> wrote:

> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   ea2bff00da89d7767d677bb68470130ba96f4928
> commit: 20549ccf4da49ff6dcb35ffc741f92aa92e07aeb [8777/13479] mm/hugetlb: free cross-zone bootmem gigantic pages after allocation
> config: parisc-randconfig-002-20260807 (https://download.01.org/0day-ci/archive/20260807/202608070433.x3vNSfjt-lkp@intel.com/config)
> compiler: hppa-linux-gcc (GCC) 8.5.0

Such an old compiler.

> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260807/202608070433.x3vNSfjt-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/202608070433.x3vNSfjt-lkp@intel.com/
> 
> All warnings (new ones prefixed by >>):
> 
>    mm/hugetlb.c: In function 'alloc_bootmem_huge_page':
> >> mm/hugetlb.c:3095: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:163:12: warning: array subscript -1 is below array bounds of 'struct list_head[1]' [-Warray-bounds]
>      new->prev = prev;
>      ~~~~~~~~~~^~~~~~

Well crap, that patch has been in there since June 12.

I can't reproduce it with the provided config and hppa-linux gcc-16.1.0.

Muchun, I'd be inclined to pretend we never saw this.  But if you want
to address it, please do a patch against mm-stable with

Fixes: 20549ccf4da4 ("mm/hugetlb: free cross-zone bootmem gigantic pages after allocation")



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Re: [linux-next:master 8777/13479] mm/hugetlb.c:3095:39: warning: array subscript 4294967295 is above array bounds of 'struct list_head[1]'
  2026-08-06 23:36 ` Andrew Morton
@ 2026-08-07 11:46   ` Muchun Song
  0 siblings, 0 replies; 3+ messages in thread
From: Muchun Song @ 2026-08-07 11:46 UTC (permalink / raw)
  To: Andrew Morton
  Cc: kernel test robot, oe-kbuild-all, Linux Memory Management List

On Fri, Aug 7, 2026 at 7:37 AM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Fri, 07 Aug 2026 05:01:04 +0800 kernel test robot <lkp@intel.com> wrote:
>
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > head:   ea2bff00da89d7767d677bb68470130ba96f4928
> > commit: 20549ccf4da49ff6dcb35ffc741f92aa92e07aeb [8777/13479] mm/hugetlb: free cross-zone bootmem gigantic pages after allocation
> > config: parisc-randconfig-002-20260807 (https://download.01.org/0day-ci/archive/20260807/202608070433.x3vNSfjt-lkp@intel.com/config)
> > compiler: hppa-linux-gcc (GCC) 8.5.0
>
> Such an old compiler.
>
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260807/202608070433.x3vNSfjt-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/202608070433.x3vNSfjt-lkp@intel.com/
> >
> > All warnings (new ones prefixed by >>):
> >
> >    mm/hugetlb.c: In function 'alloc_bootmem_huge_page':
> > >> mm/hugetlb.c:3095: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:163:12: warning: array subscript -1 is below array bounds of 'struct list_head[1]' [-Warray-bounds]
> >      new->prev = prev;
> >      ~~~~~~~~~~^~~~~~
>
> Well crap, that patch has been in there since June 12.

This isn't the first report. This is the second time we've had the
exact same report,
see [1]. Interestingly, the GCC versions are all the same (8.5.0), so
I think this must
be a GCC issue.

https://lore.kernel.org/all/202607010945.6lDjBFTU-lkp@intel.com/

Muchun,
Thanks.

>
> I can't reproduce it with the provided config and hppa-linux gcc-16.1.0.
>
> Muchun, I'd be inclined to pretend we never saw this.  But if you want
> to address it, please do a patch against mm-stable with
>
> Fixes: 20549ccf4da4 ("mm/hugetlb: free cross-zone bootmem gigantic pages after allocation")
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-07 11:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-06 21:01 [linux-next:master 8777/13479] mm/hugetlb.c:3095:39: warning: array subscript 4294967295 is above array bounds of 'struct list_head[1]' kernel test robot
2026-08-06 23:36 ` Andrew Morton
2026-08-07 11:46   ` Muchun Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox