lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090919222608.5fdf80b8@nehalam>
Date:	Sat, 19 Sep 2009 22:26:08 -0700
From:	Stephen Hemminger <shemminger@...tta.com>
To:	David Miller <davem@...emloft.net>
Cc:	netdev@...r.kernel.org
Subject: [PATCH] netdev: stats on multiqueue possible bug

Dave, I think you were trying to optimize something here that
doesn't need optimization.

If transmit stats (all) wrap to zero, then the stats would not
be set correctly. Move local variable into loop as well.

Signed-off-by: Stephen Hemminger <shemminger@...tta.com>

--- a/net/core/dev.c	2009-09-19 15:19:13.902495560 -0700
+++ b/net/core/dev.c	2009-09-19 15:48:21.126458728 -0700
@@ -5079,19 +5079,19 @@ const struct net_device_stats *dev_get_s
 		unsigned long tx_bytes = 0, tx_packets = 0, tx_dropped = 0;
 		struct net_device_stats *stats = &dev->stats;
 		unsigned int i;
-		struct netdev_queue *txq;
 
 		for (i = 0; i < dev->num_tx_queues; i++) {
-			txq = netdev_get_tx_queue(dev, i);
+			const struct netdev_queue *txq
+				 = netdev_get_tx_queue(dev, i);
 			tx_bytes   += txq->tx_bytes;
 			tx_packets += txq->tx_packets;
 			tx_dropped += txq->tx_dropped;
 		}
-		if (tx_bytes || tx_packets || tx_dropped) {
-			stats->tx_bytes   = tx_bytes;
-			stats->tx_packets = tx_packets;
-			stats->tx_dropped = tx_dropped;
-		}
+
+		stats->tx_bytes   = tx_bytes;
+		stats->tx_packets = tx_packets;
+		stats->tx_dropped = tx_dropped;
+
 		return stats;
 	}
 }
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ