]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Fix cyclades async driver timeout miscalculation
authorMarcelo Tosatti <marcelo.tosatti@cyclades.com>
Sat, 27 Mar 2004 04:56:57 +0000 (20:56 -0800)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 27 Mar 2004 04:56:57 +0000 (20:56 -0800)
This 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.

drivers/char/cyclades.c

index 3450fae83bc1333106351b8a218d453d81119efc..7ed0e09ceeef9a28c406f0c03c3769cea18ff92c 100644 (file)
@@ -2679,7 +2679,8 @@ cy_wait_until_sent(struct tty_struct *tty, int timeout)
   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 *tty, int timeout)
      */
     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;