]> 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>
Mon, 11 Nov 2024 21:09:43 +0000 (13:09 -0800)
commite3d37a6f62953962102607fe4491129271510990
tree099d7d066b82d7aaff9f859c8cd3e866e57a37a9
parent431e10601913f8f2006f3ed607e73eedf264b426
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>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/mm/slabinfo.c