From: Christoph Lameter Date: Tue, 11 Apr 2006 05:52:47 +0000 (-0700) Subject: [PATCH] Fix NULL pointer dereference in node_read_numastat() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=54404e72cd3758e465fb6362f6d71e22b705c589;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git [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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/base/node.c b/drivers/base/node.c index 16c513aa4d48..c80c3aeed004 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -106,7 +106,7 @@ static ssize_t node_read_numastat(struct sys_device * dev, char * buf) other_node = 0; for (i = 0; i < MAX_NR_ZONES; i++) { struct zone *z = &pg->node_zones[i]; - for (cpu = 0; cpu < NR_CPUS; cpu++) { + for_each_online_cpu(cpu) { struct per_cpu_pageset *ps = zone_pcp(z,cpu); numa_hit += ps->numa_hit; numa_miss += ps->numa_miss;