All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Muchun Song <songmuchun@bytedance.com>
Cc: oe-kbuild-all@lists.linux.dev,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: [linux-next:master 1981/2307] mm/hugetlb.c:3091:39: warning: array subscript 4294967295 is above array bounds of 'struct list_head[1]'
Date: Thu, 02 Jul 2026 07:38:32 +0800	[thread overview]
Message-ID: <202607020711.qYf0IlRF-lkp@intel.com> (raw)

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

                 reply	other threads:[~2026-07-01 23:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202607020711.qYf0IlRF-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=songmuchun@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.