[PATCH corrected] net/ipv4/route.c, kernel 2.4.20

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3 May 2003, David S. Miller wrote:

> On Fri, 2003-04-18 at 04:22, Arcady Stepanov wrote:
> > The patch is trivial:
> 
> This patch is wrong.
> 
> You probably want to keep IP_RT_ACCT_CPU() how it is, cast _THAT_
> to "u8 *" then add in the offset.

You certainly right, David. Sorry, it's my mistake... Here
is corrected version:
 
--- route.c.orig	Sun Jan  5 15:29:10 2003
+++ route.c	Tue May  6 12:30:42 2003
@@ -2442,17 +2442,22 @@
 		*eof = 1;
 	}
 
-	/* Copy first cpu. */
 	*start = buffer;
-	memcpy(buffer, IP_RT_ACCT_CPU(0), length);
 
-	/* Add the other cpus in, one int at a time */
-	for (i = 1; i < smp_num_cpus; i++) {
-		unsigned int j;
-		for (j = 0; j < length/4; j++)
-			((u32*)buffer)[j] += ((u32*)IP_RT_ACCT_CPU(i))[j];
+	if (length > 0)
+	{
+		/* Copy first cpu. */
+		memcpy(buffer, (u8*)IP_RT_ACCT_CPU(0) + offset, length);
+
+		/* Add the other cpus in, one int at a time */
+		for (i = 1; i < smp_num_cpus; i++) {
+			unsigned int j;
+			for (j = 0; j < length/4; j++)
+				((u32*)buffer)[j] += ((u32*)((u8*)IP_RT_ACCT_CPU(i) + offset))[j];
+		}
+		return length;
 	}
-	return length;
+	return 0;
 }
 #endif

-- 
   BW, Arcady Stepanov (AS713-RIPE, AS28-RIPN).

   Micronic on-line Network Operating Center.
   email:noc@mol.ru; phone: +7 095 2320012

==========================================
 All that we can do is just survive
 All that we can do to help ourselves
 Is stay alive...
 
    Rush, "Red Sector A"
==========================================

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux