]> www.infradead.org Git - users/jedix/linux-maple.git/commit
tools/mm: fix slabinfo crash when MAX_SLABS is exceeded
authorMarc Dionne <marc.dionne@auristor.com>
Thu, 31 Oct 2024 10:55:34 +0000 (07:55 -0300)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 1 Nov 2024 04:29:36 +0000 (21:29 -0700)
commitacb3bc729b542d2f9ed935fbc41b9f0c11056942
treeb7673a85a7290d365660398b706fa63d2a4eaee4
parentb323607789cdfe9d2db7a38bd648c385f6debd38
tools/mm: fix slabinfo crash when MAX_SLABS is exceeded

The number of slabs can easily exceed the hard coded MAX_SLABS in the
slabinfo tool, causing it to overwrite memory and crash.

Increase the value of MAX_SLABS, and check if that has been exceeded for
each new slab, instead of at the end when it's already too late.  Also
move the check for MAX_ALIASES into the loop body.

Link: https://lkml.kernel.org/r/20241031105534.565533-1-marc.c.dionne@gmail.com
Signed-off-by: Marc Dionne <marc.dionne@auristor.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/mm/slabinfo.c