Skip to contentSkip to conversation

Fix cyclades async driver timeout miscalculation

PATCH New Marcelo Tosatti 1 participant 1 message Mar 27, 2004 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix cyclades async driver timeout miscalculation

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.

drivers/char/cyclades.c renamed from drivers/char/cyclades.c.orig +3 -2
@@ -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;