public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
To: torvalds@osdl.org, akpm@osdl.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] Fix cyclades async driver timeout miscalculation
Date: Sat, 27 Mar 2004 02:39:23 -0300	[thread overview]
Message-ID: <20040327053922.GA6961@logos.cnet> (raw)

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


Hi, 

The attached patch fixes a problem where cy_wait_until_sent()
miscalculates (calculate -1 on a unsigned long) the "char_time" 
parameter passed to schedule_timeout(). 

Fix that by making it a signed long, and checking for 
negative value.

Please apply.

[-- Attachment #2: cy_wait_fix.patch --]
[-- Type: text/plain, Size: 812 bytes --]

--- linux-2.6.4/drivers/char/cyclades.c.orig	2004-03-27 02:30:40.050030160 -0300
+++ linux-2.6.4/drivers/char/cyclades.c	2004-03-27 02:30:44.878296152 -0300
@@ -2679,7 +2679,8 @@ cy_wait_until_sent(struct tty_struct *tt
   struct cyclades_port * info = (struct cyclades_port *)tty->driver_data;
   unsigned char *base_addr;
   int card,chip,channel,index;
-  unsigned long orig_jiffies, char_time;
+  unsigned long orig_jiffies;
+  signed long char_time;
 	
     if (serial_paranoia_check(info, tty->name, "cy_wait_until_sent"))
 	return;
@@ -2699,7 +2700,7 @@ cy_wait_until_sent(struct tty_struct *tt
      */
     char_time = (info->timeout - HZ/50) / info->xmit_fifo_size;
     char_time = char_time / 5;
-    if (char_time == 0)
+    if (char_time <= 0)
 	char_time = 1;
     if (timeout < 0)
 	timeout = 0;

                 reply	other threads:[~2004-03-27  5:48 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=20040327053922.GA6961@logos.cnet \
    --to=marcelo.tosatti@cyclades.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /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