From: Mehdi Ben Hadj Khelifa Date: Sat, 18 Oct 2025 20:11:48 +0000 (+0100) Subject: mm/vmalloc: use kmalloc_array() instead of kmalloc() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=f304188e0c12d4e10577a16d4ffc6ac773533307;p=users%2Fjedix%2Flinux-maple.git mm/vmalloc: use kmalloc_array() instead of kmalloc() The number of NUMA nodes (nr_node_ids) is bounded, so overflow is not a practical concern here. However, using kmalloc_array() better reflects the intent to allocate an array of unsigned ints, and improves consistency with other NUMA-related allocations. No functional change intended. Link: https://lkml.kernel.org/r/20251018201207.27441-1-mehdi.benhadjkhelifa@gmail.com Signed-off-by: Mehdi Ben Hadj Khelifa Reviewed-by: Uladzislau Rezki (Sony) Reviewed-by: Vishal Moola (Oracle) Reviewed-by: Khalid Aziz Cc: David Hunter Signed-off-by: Andrew Morton --- diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 091a07f6d925..adde450ddf5e 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -5140,7 +5140,7 @@ static int vmalloc_info_show(struct seq_file *m, void *p) unsigned int *counters; if (IS_ENABLED(CONFIG_NUMA)) - counters = kmalloc(nr_node_ids * sizeof(unsigned int), GFP_KERNEL); + counters = kmalloc_array(nr_node_ids, sizeof(unsigned int), GFP_KERNEL); for_each_vmap_node(vn) { spin_lock(&vn->busy.lock);