netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix for integer overflow in hd6457[02] driver code
@ 2004-09-05 14:26 Krzysztof Halasa
  0 siblings, 0 replies; only message in thread
From: Krzysztof Halasa @ 2004-09-05 14:26 UTC (permalink / raw)
  To: Jeff Garzik, marcelo.tosatti, netdev

[-- Attachment #1: Type: text/plain, Size: 324 bytes --]

Hi,

The attached patch fixes an integer overflow in drivers for N2, C101,
PCI200SYN WAN cards (brv * port->settings.clock_rate overflowed at
requested clock rate of 8*1024*1024 bps, problem noted by Nagaraj Kanniah).

Please apply to 2.4 and 2.6 kernel trees. Thanks.

[now the patch has made it here]
-- 
Krzysztof Halasa

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: hd6457x-speed-fix.patch --]
[-- Type: text/x-patch, Size: 753 bytes --]

--- linux-2.6/drivers/net/wan/hd6457x.c	1 Jun 2004 03:47:44 -0000
+++ linux-2.6/drivers/net/wan/hd6457x.c	5 Sep 2004 13:59:22 -0000
@@ -463,8 +463,8 @@
 			brv >>= 1; /* brv = 2^9 = 512 max in specs */
 
 			/* Baud Rate = CLOCK_BASE / TMC / 2^BR */
-			tmc = CLOCK_BASE / (brv * port->settings.clock_rate);
-		}while(br > 1 && tmc <= 128);
+			tmc = CLOCK_BASE / brv / port->settings.clock_rate;
+		}while (br > 1 && tmc <= 128);
 
 		if (tmc < 1) {
 			tmc = 1;
@@ -473,7 +473,7 @@
 		} else if (tmc > 255)
 			tmc = 256; /* tmc=0 means 256 - low baud rates */
 
-		port->settings.clock_rate = CLOCK_BASE / (brv * tmc);
+		port->settings.clock_rate = CLOCK_BASE / brv / tmc;
 	} else {
 		br = 9; /* Minimum clock rate */
 		tmc = 256;	/* 8bit = 0 */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-09-05 14:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-05 14:26 [PATCH] fix for integer overflow in hd6457[02] driver code Krzysztof Halasa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).