]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Fix NULL pointer dereference in node_read_numastat()
authorChristoph Lameter <clameter@sgi.com>
Mon, 3 Apr 2006 10:11:57 +0000 (20:11 +1000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 7 Apr 2006 16:44:29 +0000 (09:44 -0700)
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: Greg Kroah-Hartman <gregkh@suse.de>
drivers/base/node.c

index 16c513aa4d4877afa7522eedc7e695568648cbf7..c80c3aeed004a558de9cf9db0632191cf1c16c99 100644 (file)
@@ -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;