From fbd033bea0b9d025c5648f43b237097e6c45536d Mon Sep 17 00:00:00 2001 From: Marcelo Tosatti Date: Fri, 26 Mar 2004 20:56:57 -0800 Subject: [PATCH] [PATCH] Fix cyclades async driver timeout miscalculation 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index 3450fae83bc13..7ed0e09ceeef9 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c @@ -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; -- 2.53.0