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

[PATCH] Fix NULL pointer dereference in node_read_numastat()

zone_pcp() only returns valid values if the processor is online.

Change node_read_numastat() to only scan online processors.

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

authored by

Christoph Lameter and committed by
Linus Torvalds
54404e72 29ff2db5

+1 -1
+1 -1
drivers/base/node.c
··· 106 106 other_node = 0; 107 107 for (i = 0; i < MAX_NR_ZONES; i++) { 108 108 struct zone *z = &pg->node_zones[i]; 109 - for (cpu = 0; cpu < NR_CPUS; cpu++) { 109 + for_each_online_cpu(cpu) { 110 110 struct per_cpu_pageset *ps = zone_pcp(z,cpu); 111 111 numa_hit += ps->numa_hit; 112 112 numa_miss += ps->numa_miss;