Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

SLUB: fix behavior if the text output of list_locations overflows PAGE_SIZE

If slabs are allocated or freed from a large set of call sites (typical for
the kmalloc area) then we may create more output than fits into a single
PAGE and sysfs only gives us one page. The output should be truncated.
This patch fixes the checks to do the truncation properly.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Christoph Lameter and committed by
Linus Torvalds
84966343 1e27dbe7

+4 -2
+4 -2
mm/slub.c
··· 3042 3042 n += sprintf(buf + n, " pid=%ld", 3043 3043 l->min_pid); 3044 3044 3045 - if (num_online_cpus() > 1 && !cpus_empty(l->cpus)) { 3045 + if (num_online_cpus() > 1 && !cpus_empty(l->cpus) && 3046 + n < PAGE_SIZE - 60) { 3046 3047 n += sprintf(buf + n, " cpus="); 3047 3048 n += cpulist_scnprintf(buf + n, PAGE_SIZE - n - 50, 3048 3049 l->cpus); 3049 3050 } 3050 3051 3051 - if (num_online_nodes() > 1 && !nodes_empty(l->nodes)) { 3052 + if (num_online_nodes() > 1 && !nodes_empty(l->nodes) && 3053 + n < PAGE_SIZE - 60) { 3052 3054 n += sprintf(buf + n, " nodes="); 3053 3055 n += nodelist_scnprintf(buf + n, PAGE_SIZE - n - 50, 3054 3056 l->nodes);