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 1977/2307] mm/hugetlb.c:3095:4: warning: array subscript -1 is below array bounds of 'struct list_head[1]'
Date: Wed, 01 Jul 2026 09:36:44 +0800 [thread overview]
Message-ID: <202607010945.6lDjBFTU-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: be5c93fa674f0fc3c8f359c2143abce6bbb422e6
commit: f48ee682d55e3602fcc194cb93b8398f2546e53f [1977/2307] mm/hugetlb: free cross-zone bootmem gigantic pages after allocation
config: sparc-randconfig-r131-20260701 (https://download.01.org/0day-ci/archive/20260701/202607010945.6lDjBFTU-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 8.5.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260701/202607010945.6lDjBFTU-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/202607010945.6lDjBFTU-lkp@intel.com/
All warnings (new ones prefixed by >>):
mm/hugetlb.c: In function 'alloc_bootmem_huge_page':
>> mm/hugetlb.c:3095:4: warning: array subscript -1 is below array bounds of 'struct list_head[1]' [-Warray-bounds]
list_add(&m->list, &huge_boot_pages[nid_request]);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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
next reply other threads:[~2026-07-01 1:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 1:36 kernel test robot [this message]
2026-07-01 14:53 ` [linux-next:master 1977/2307] mm/hugetlb.c:3095:4: warning: array subscript -1 is below array bounds of 'struct list_head[1]' Muchun Song
2026-07-01 18:13 ` Andrew Morton
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=202607010945.6lDjBFTU-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.