From 1013f2719d54cc328257036dc27e579658d09133 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Thu, 30 Nov 2017 00:00:00 -0600 Subject: [PATCH] slabtop: let's stop always ignoring the last slab node This patch will fix a fencepost error that has existed since at least 2004, the result of which was to always completely ignore that last merged / sorted slab node. [ Of course, little harm was done since output would ] [ have been limited to a terminal's height. Thus, it ] [ would have required a huge display before noticed. ] [ But, now that the run once switch shows everything ] [ such an omission would become really unforgivable. ] Signed-off-by: Jim Warner --- slabtop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slabtop.c b/slabtop.c index c0bf54f7..80be0a9d 100644 --- a/slabtop.c +++ b/slabtop.c @@ -410,7 +410,7 @@ int main(int argc, char *argv[]) attroff(A_REVERSE); curr = slab_list; - for (i = 0; i < rows - 8 && curr->next; i++) { + for (i = 0; i < rows - 8 && curr; i++) { print_line("%6u %6u %3u%% %7.2fK %6u %8u %9uK %-23s\n", curr->nr_objs, curr->nr_active_objs, curr->use, curr->obj_size / 1024.0, curr->nr_slabs,