Commit 6d35bbea authored by David S. Miller's avatar David S. Miller

[IPV4]: Fix ip_rt_acct reading.

parent 8b1309d9
...@@ -2605,17 +2605,28 @@ static int ip_rt_acct_read(char *buffer, char **start, off_t offset, ...@@ -2605,17 +2605,28 @@ static int ip_rt_acct_read(char *buffer, char **start, off_t offset,
*eof = 1; *eof = 1;
} }
/* Copy first cpu. */ offset /= sizeof(u32);
*start = buffer;
memcpy(buffer, IP_RT_ACCT_CPU(0), length); if (length > 0) {
u32 *src = ((u32 *) IP_RT_ACCT_CPU(0)) + offset;
/* Add the other cpus in, one int at a time */ u32 *dst = (u32 *) buffer;
for (i = 1; i < NR_CPUS; i++) {
unsigned int j; /* Copy first cpu. */
if (!cpu_online(i)) *start = buffer;
continue; memcpy(dst, src, length);
for (j = 0; j < length/4; j++)
((u32*)buffer)[j] += ((u32*)IP_RT_ACCT_CPU(i))[j]; /* Add the other cpus in, one int at a time */
for (i = 1; i < NR_CPUS; i++) {
unsigned int j;
if (!cpu_online(i))
continue;
src = ((u32 *) IP_RT_ACCT_CPU(i)) + offset;
for (j = 0; j < length/4; j++)
dst[j] += src[j];
}
} }
return length; return length;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment