aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmalloc.c
diff options
context:
space:
mode:
authorMehdi Ben Hadj Khelifa <mehdi.benhadjkhelifa@gmail.com>2025-10-18 21:11:48 +0100
committerAndrew Morton <akpm@linux-foundation.org>2025-11-16 17:28:14 -0800
commitf0c74b6cb91d97cea74176a5400e89c183732cb2 (patch)
treed779b9d57235c710cb2a39a5b7afbb7c0b22dc0a /mm/vmalloc.c
parent184c7533426ada7625c029b54143fec4ef4daa28 (diff)
downloadtip-f0c74b6cb91d97cea74176a5400e89c183732cb2.tar.gz
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 <mehdi.benhadjkhelifa@gmail.com> Reviewed-by: Uladzislau Rezki (Sony) <urezki@gmail.com> Reviewed-by: Vishal Moola (Oracle) <vishal.moola@gmail.com> Reviewed-by: Khalid Aziz <khalid@kernel.org> Cc: David Hunter <david.hunter.linux@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r--mm/vmalloc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 091a07f6d92524..adde450ddf5e2f 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);