]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[NET]: Corrects a bug in ip_rt_acct_read()
authorEric Dumazet <dada1@cosmosbay.com>
Fri, 16 Nov 2007 10:29:24 +0000 (02:29 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Mon, 19 Nov 2007 02:47:38 +0000 (18:47 -0800)
It seems that stats of cpu 0 are counted twice, since
for_each_possible_cpu() is looping on all possible cpus, including 0

Before percpu conversion of ip_rt_acct, we should also remove the
assumption that CPU 0 is online (or even possible)

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/route.c

index 1bff9ed349ff5a9e5d14ba1f09888e304bd88950..c426dec6d57903467fd5cd7a233a872efa0524ce 100644 (file)
@@ -2888,18 +2888,14 @@ static int ip_rt_acct_read(char *buffer, char **start, off_t offset,
        offset /= sizeof(u32);
 
        if (length > 0) {
-               u32 *src = ((u32 *) IP_RT_ACCT_CPU(0)) + offset;
                u32 *dst = (u32 *) buffer;
 
-               /* Copy first cpu. */
                *start = buffer;
-               memcpy(dst, src, length);
+               memset(dst, 0, length);
 
-               /* Add the other cpus in, one int at a time */
                for_each_possible_cpu(i) {
                        unsigned int j;
-
-                       src = ((u32 *) IP_RT_ACCT_CPU(i)) + offset;
+                       u32 *src = ((u32 *) IP_RT_ACCT_CPU(i)) + offset;
 
                        for (j = 0; j < length/4; j++)
                                dst[j] += src[j];