netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Halasa <khc@pm.waw.pl>
To: Jeff Garzik <jgarzik@pobox.com>,
	marcelo.tosatti@cyclades.com, <netdev@oss.sgi.com>
Subject: [PATCH] fix for integer overflow in hd6457[02] driver code
Date: Sun, 05 Sep 2004 16:26:26 +0200	[thread overview]
Message-ID: <m3u0ucrdv1.fsf@defiant.pm.waw.pl> (raw)

[-- 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 */

                 reply	other threads:[~2004-09-05 14:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3u0ucrdv1.fsf@defiant.pm.waw.pl \
    --to=khc@pm.waw.pl \
    --cc=jgarzik@pobox.com \
    --cc=marcelo.tosatti@cyclades.com \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).